diff options
author | wm4 <wm4@nowhere> | 2014-01-31 19:50:56 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-01-31 22:17:43 +0100 |
commit | d8dd9a6725a0f9b961c641ed83b325bbdbb82482 (patch) | |
tree | b49838266b80da294ecb4e89028b4d2bc36315e1 /waftools | |
parent | a17be5576fae918c683688a0e2bd2fd21b32d428 (diff) |
threads: add function to calculate deadline for timed waits
Usually, you have to call pthread_cond_timedwait() in a loop (because it
can wake up sporadically). If this function is used by another higher
level function, which uses a relative timeout, we actually have to
reduce the timeout on each iteration - or, simpler, compute the
"deadline" at the beginning of the function, and always pass the same
absolute time to the waiting function.
Might be unsafe if the system time is changed. On the other hand, this
is a fundamental race condition with these APIs.
Diffstat (limited to 'waftools')
0 files changed, 0 insertions, 0 deletions