One of the reasons to use Qt is the cross-platform development. Good Qt projects can be rebuild on a different platform; and the resulting application should work on a different OS.
This
WaitForSingleObject
is Windows-specific:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687032%28v=vs.85%29.aspx[
^].
If you use it in your code, it will kill your platform compatibility.
And
QWaitCondition
is the part of Qt, designed to abstract out the platform:
http://qt-project.org/doc/qt-4.8/qwaitcondition.html[
^].
Now, I'm not sure you understand thread synchronization. You are trying to wait inside a lock. The wait is itself a synchronization method to be used with multiple threads. The combinations like waiting inside a lock is the sure way to create some deadlocks. All thread synchronization should be theoretically proven.
—SA