mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-05 12:12:28 +00:00
Rewrite Windows poll()
We can now await signals, files, pipes, and console simultaneously. This change also gives a deeper review and testing to changes made yesterday.
This commit is contained in:
parent
cceddd21b2
commit
fbdf9d028c
15 changed files with 425 additions and 191 deletions
|
@ -23,6 +23,10 @@
|
|||
#include "third_party/nsync/cv.h"
|
||||
#include "third_party/nsync/futex.internal.h"
|
||||
|
||||
__static_yoink("nsync_mu_lock");
|
||||
__static_yoink("nsync_mu_unlock");
|
||||
__static_yoink("nsync_mu_trylock");
|
||||
|
||||
/**
|
||||
* Wakes all threads waiting on condition, e.g.
|
||||
*
|
||||
|
@ -43,9 +47,14 @@
|
|||
errno_t pthread_cond_broadcast(pthread_cond_t *cond) {
|
||||
|
||||
#if PTHREAD_USE_NSYNC
|
||||
// do nothing if pthread_cond_timedwait() hasn't been called yet
|
||||
// this is because we dont know for certain if nsync use is safe
|
||||
if (!atomic_load_explicit(&cond->_waited, memory_order_acquire))
|
||||
return 0;
|
||||
|
||||
// favor *NSYNC if this is a process private condition variable
|
||||
// if using Mike Burrows' code isn't possible, use a naive impl
|
||||
if (!cond->_pshared && !IsXnuSilicon()) {
|
||||
if (!cond->_footek) {
|
||||
nsync_cv_broadcast((nsync_cv *)cond);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue