#ifndef	lint
static char rcs_id[] = "$Header: mutex.c,v 1.3 88/05/09 16:02:40 ecc Exp $";
#endif	not lint

/*
 * threads/mutex.c
 *
 * $Source: /usr0/ecc/nectar/src/cab/threads/RCS/mutex.c,v $
 *
 * Mutex objects.
 */


/* #include <nectar_sys.h>*/
#include <threads.h>

/*
 * Mutex_Wait_Lock is implemented in terms of Mutex_Try_Lock().
 */

EXPORT void
Mutex_Wait_Lock(m)
	Mutex_t m;
    BEGIN(Mutex_Wait_Lock)
	for (;;) {
		if (m->lock == 0 && Mutex_Try_Lock(m))
			RET;
		else
			Thread_Yield();
	}
    END(Mutex_Wait_Lock)
