Good morning,

I am migrating an application developed for Windows to Ubuntu using Qt-4.6. So far I am making good progress but there are two Windows functions that are giving me trouble.

I have been using QWaitCondition objects to reproduce the behaviour of Windows events (CreateEvent(), SetEvent(), and WaitForSingleObject()). In Windows, for WaitForSingleObject(), if the time-out argument (dwMilliseconds) is zero, the function does not enter a wait state if the object (event) is not signalled; it always returns immediately. The returned value indicates whether the object has been signalled.

I tried to reproduce this behaviour using QWaitCondition::wait() with time-out set to zero without success. The locked mutex is not released and the function always returns false indicating that the wait timed out. I could not find any description related to time-out set to zero either.

What is the corresponding behaviour in Qt for WaitForSingleObject() using time-out set to zero?

My second question is about QThread. Again, the migration is mostly working but I don't know how to reproduce the behaviour of Windows Sleep( 0).
According to the documentation, a value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.

How is this behaviour reproduced using Qt? Do I simply use a sleep statement? In this case, what time value is used? The application is running live image processing and display.

Thanks in advance
Daniel