Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
4.8.x
-
None
Description
QWaitCondition::wait states the returned value as follows:
// -------
The mutex will be unlocked, and the calling thread will block until either of these conditions is met:
- Another thread signals it using wakeOne() or wakeAll(). This function will return true in this case.
- time milliseconds has elapsed. If time is ULONG_MAX (the default), then the wait will never timeout (the event must be signalled). This function will return false if the wait timed out.
// --------
This leaves open what is returned when both anoter thread calles "wakeOne" or "wakeAll" and the "time milliseconds" has elapsed. Since you cannot ensure in a waking thread that the time has not yet elapsed when calling "wake*" (due to scheduling/execution delays and the weak definition of "thread signals it using ..."), essentially any use of a timeout "wait" with a corresponding "wake*" is undefined or not sufficiently defined behavior.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-25197 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
64397,2 | QWaitCondition: don't return false if woken up explicitly meanwhile | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |