mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +00:00
Improve cancellations, randomness, and time
- Exhaustively document cancellation points - Rename SIGCANCEL to SIGTHR just like BSDs - Further improve POSIX thread cancellations - Ensure asynchronous cancellations work correctly - Elevate the quality of getrandom() and getentropy() - Make futexes cancel correctly on OpenBSD 6.x and 7.x - Add reboot.com and shutdown.com to examples directory - Remove underscore prefix from awesome timespec_*() APIs - Create assertions that help verify our cancellation points - Remove bad timespec APIs (cmp generalizes eq/ne/gt/gte/lt/lte)
This commit is contained in:
parent
0d7c265392
commit
3f0bcdc3ef
173 changed files with 1599 additions and 782 deletions
14
third_party/nsync/cv.h
vendored
14
third_party/nsync/cv.h
vendored
|
@ -114,8 +114,10 @@ void nsync_cv_broadcast(nsync_cv *cv);
|
|||
return. Equivalent to a call to nsync_mu_wait_with_deadline() with
|
||||
abs_deadline==nsync_time_no_deadline, and cancel_note==NULL. Callers
|
||||
should use nsync_cv_wait() in a loop, as with all standard Mesa-style
|
||||
condition variables. See examples above. */
|
||||
void nsync_cv_wait(nsync_cv *cv, nsync_mu *mu);
|
||||
condition variables. See examples above. Returns 0 normally, otherwise
|
||||
ECANCELED may be returned if calling POSIX thread is cancelled only when
|
||||
the PTHREAD_CANCEL_MASKED mode is in play. */
|
||||
int nsync_cv_wait(nsync_cv *cv, nsync_mu *mu);
|
||||
|
||||
/* Atomically release "mu" (which must be held on entry) and block the
|
||||
calling thread on *cv. It then waits until awakened by a call to
|
||||
|
@ -124,9 +126,11 @@ void nsync_cv_wait(nsync_cv *cv, nsync_mu *mu);
|
|||
In all cases, it reacquires "mu", and returns the reason for the call
|
||||
returned (0, ETIMEDOUT, or ECANCELED). Use
|
||||
abs_deadline==nsync_time_no_deadline for no deadline, and
|
||||
cancel_note==NULL for no cancellation. wait_with_deadline() should be
|
||||
used in a loop, as with all Mesa-style condition variables. See
|
||||
examples above.
|
||||
cancel_note==NULL for no nsync cancellations (however POSIX thread
|
||||
cancellations may still happen, and ECANCELED could still be returned
|
||||
when the calling thread is cancelled only if PTHREAD_CANCEL_MASKED is
|
||||
in play). wait_with_deadline() should be used in a loop, as with all
|
||||
Mesa-style condition variables. See examples above.
|
||||
|
||||
There are two reasons for using an absolute deadline, rather than a
|
||||
relative timeout---these are why pthread_cond_timedwait() also uses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue