diff options
-rw-r--r-- | src/corelib/thread/qsemaphore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 15f45b6..5fa41f1 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -224,7 +224,7 @@ bool QSemaphore::tryAcquire(int n, int timeout) timer.start(); while (n > d->avail) { const qint64 elapsed = timer.elapsed(); - if (timeout - elapsed > 0 + if (timeout - elapsed <= 0 || !d->cond.wait(locker.mutex(), timeout - elapsed)) return false; } |