[collectd] [PATCH] Bugfix: correctly handle spurious wakeups in pthread_cond_timedwait
Michael Stapelberg
michael+collectd at stapelberg.de
Sat Feb 6 16:22:16 CET 2010
Hi,
attached to this email you find a patch against git revision
ced2f3438fb1c333cd582a7d944d524b56ba0ef3, fixing a problem on machines with
more than one CPU (I did not test if single-machine computers are also
affected, though) running NetBSD (other systems might be affected, too).
The problem was that pthread_cond_timedwait was used to sleep for a specific
amount of time. However, spurious wakeups may happen and thus
pthread_cond_timedwait may return without the timeout having actually passed.
Therefore, I implemented a function which checks if the timeout has already
happened and calls pthread_cond_timedwait again if it has not.
This behaviour of pthread_cond_timedwait is documented in its manpage (the
linux manpage of pthread_cond_timedwait is much more helpful than the one
delivered with NetBSD in this case).
So, please merge this commit for the next release.
Best regards,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Bugfix-spurious-wakeups.patch
Type: application/octet-stream
Size: 1945 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100206/8871c0be/attachment.obj
More information about the collectd
mailing list