[Qt-interest] Qt 4 with no threads

Justin Noel justin at ics.com
Wed Apr 8 21:31:06 CEST 2009


Detlev Casanova wrote:
> Hello,
> I'd like to know if threads are an absolutely necessary in Qt 4.
> I'd like to port it to an operating system which does not support threads 
> (Minix 3 but that's not the point).
> Minix has user-level threads though. But I'm not sure it will do the trick.
> Also, I'm only speaking of QtCore here, without the QThread class (and any 
> subclasses).
>
> I repeat that I want to port it, not have an option in ./configure to disable 
> threads.
>   

Qt itself does not use any threads internally. You can easily disable
threads a couple of ways. Check out this page.
http://doc.trolltech.com/4.5/fine-tuning-features.html

You can do any of the following to disable features in Qt:

1) Use ./configure -no-feature-thread. I'm not sure if this is available
with the X11 Qt version. Never tried.

2) Use a qconfig file with ./configure -qconfig myfile. There are a
couple qconfig examples in src/corelib/global. The full list of possible
defines is in qfeatures.h.  I'm also not sure if the ./configure with
-qconfig works for the X11 version of Qt.

3)  You can just edit the src/corelib/global qfeatures.h file yourself
and get the same effect as above. This works in all versions of Qt.

4) In the mkspec you create for your platform you can permanently define
-DNO_QTHREAD, however, that will only work for the qt build and other
qmake users.

You mention user-space threads. Those are usually supported via the
POSIX  threads API and is the only threading API Qt for UNIX uses. Qt
doesn't use native threads on any UNIX OS. If POSIX threads work then
chances are QThread is just going to work out of the box.  Does Minix
support SysV Shared Memory? If not you will need to turn off
QSharedMemory and QSystemSemaphore using one of the above approaches.

The hardest part of your port will be probably be graphics. You either
need to port the *qws* files from the embedded linux version of Qt or
support X11. I'm not sure which will be more painful ;) If there isn't
already an X port to Minix3 you'll probably want to stick with rewriting
the qws files to use whatever framebuffer device Minix3 give you.

Good Luck!
--Justin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090408/7ae8292c/attachment.vcf 


More information about the Qt-interest-old mailing list