Add a function to do the relative waits, simplifying the code a little
More to come. Change-Id: I108f23e94c322ad4e1466ff69100ad6af91d95e9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
786c790176
commit
2fbe972a65
@ -104,14 +104,19 @@ public:
|
||||
int waiters;
|
||||
int wakeups;
|
||||
|
||||
int wait_relative(unsigned long time)
|
||||
{
|
||||
timespec ti;
|
||||
qt_abstime_for_timeout(&ti, time);
|
||||
return pthread_cond_timedwait(&cond, &mutex, &ti);
|
||||
}
|
||||
|
||||
bool wait(unsigned long time)
|
||||
{
|
||||
int code;
|
||||
forever {
|
||||
if (time != ULONG_MAX) {
|
||||
timespec ti;
|
||||
qt_abstime_for_timeout(&ti, time);
|
||||
code = pthread_cond_timedwait(&cond, &mutex, &ti);
|
||||
code = wait_relative(time);
|
||||
} else {
|
||||
code = pthread_cond_wait(&cond, &mutex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user