pthread_tryjoin_np.3: Note that pthread_timedjoin_np() uses CLOCK_REALTIME, but there's a bug

Learned from an email converasation with Mike Crowe, and
verified by experiment.

Reported-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-11-23 10:32:03 +01:00
parent bdcc471b64
commit 6c9fd46b05
1 changed files with 16 additions and 1 deletions

View File

@ -63,7 +63,10 @@ If
.I thread
has not yet terminated,
then the call blocks until a maximum time, specified in
.IR abstime .
.IR abstime ,
measured against the
.BR CLOCK_REALTIME
clock.
If the timeout expires before
.I thread
terminates,
@ -157,6 +160,18 @@ if (s != 0) {
}
.EE
.in
.SH BUGS
The
.BR pthread_timedjoin_np ()
function measures time by internally calculating a relative sleep interval
that is then measured against the
.BR CLOCK_MONOTONIC
clock instead of the
.BR CLOCK_REALTIME
clock.
Consequently, the timeout is unaffected by discontinuous changes to the
.BR CLOCK_REALTIME
clock.
.SH SEE ALSO
.BR clock_gettime (2),
.BR pthread_exit (3),