/**
 * @brief Unlock the semaphore and wake sleeping threads.  Also does a data
 *        barrier before unlocking so any modifications made before the lock
 *        gets released will be completed before the lock is released.
 * @param mutex as passed to Mutex_Lock()
 * @param mode  as passed to Mutex_Lock()
 * @param cvi   which condition variable to signal
 * @param all   false: wake a single thread<br>
 *              true: wake all threads
 */
void
Mutex_UnlWake(Mutex *mutex,
	      MutexMode mode,
	      uint32 cvi,
	      _Bool all)
{
	Mutex_Unlock(mutex, mode);
	Mutex_CondSig(mutex, cvi, all);
}
Ejemplo n.º 2
0
void
Mksck_WakeBlockedSockets(MksckPage *mksckPage)
{
	Mksck *mksck;
	uint32 i, wakeHostRecv;

	wakeHostRecv = mksckPage->wakeHostRecv;
	if (wakeHostRecv != 0) {
		mksckPage->wakeHostRecv = 0;
		for (i = 0; wakeHostRecv != 0; i++) {
			if (wakeHostRecv & 1) {
				mksck = &mksckPage->sockets[i];
				Mutex_CondSig(&mksck->mutex,
					      MKSCK_CVAR_FILL, true);
			}
			wakeHostRecv >>= 1;
		}
	}