void runtime_notewakeup(Note *n) { if(runtime_xchg((uint32*)&n->key, 1)) runtime_throw("notewakeup - double wakeup"); runtime_futexwakeup((uint32*)&n->key, 1); }
void runtime_unlock(Lock *l) { uint32 v; if(--runtime_m()->locks < 0) runtime_throw("runtime_unlock: lock count"); v = runtime_xchg(&l->key, MUTEX_UNLOCKED); if(v == MUTEX_UNLOCKED) runtime_throw("unlock of unlocked lock"); if(v == MUTEX_SLEEPING) runtime_futexwakeup(&l->key, 1); }
void runtime_notewakeup(Note *n) { runtime_xchg(&n->key, 1); runtime_futexwakeup(&n->key, 1); }