Qt and POSIX
I have to develop a Linux daemon that uses the POSIX API to create POSIX threads and POSIX message queues. I would like to use Qt to develop this daemon to take advantage of the Qt libraries and signal/slot mechanism, understanding that the application will not be platform independent. Is it possible to use POSIX API for POSIX threads and message queues with Qt and signals/slots? If so, is there an example of how to do this?
These are three questions:
1.) can you use POSIX functions inside Qt? Anser is yes, its C/C++ and you can do anything that C/C++ allows.
2.) Can you use possix threads? Theoretically yes. But, and that is the important thing, you can’t use signal/slot across threads without using QtThreads and Qt message loops.
3.) What do you want to do with POSIX message queues? Inter process communication? Then see answer 1 :-)
Take a look at the QtService solution [qt.gitorious.org]. I have used this successfully in the past.
I would just use QThread for conveniemce since it just wraps POSIX threads.
Just a note: Local sockets would be more portable than POSIX message queues. Also it scales better if you intend to distribute among more machines later. (see: http://doc.qt.nokia.com/4.7-snapshot/qlocalsocket.html
[EDIT: fixed link, Volker]