rminnichinitial1fcdf7916 years agoHistory
38 lines · 504 B · C
RawDownload
#include <u.h>#include <libc.h>#include "iotrack.h"#include "dat.h"#include "fns.h" voidmlock(MLock *l){ 	if(l->key != 0 && l->key != 1)		panic("uninitialized lock");	if (l->key)		panic("lock");	l->key = 1;} voidunmlock(MLock *l){ 	if(l->key != 0 && l->key != 1)		panic("uninitialized unlock");	if (!l->key)		panic("unlock");	l->key = 0;} intcanmlock(MLock *l){	if(l->key != 0 && l->key != 1)		panic("uninitialized canlock");	if (l->key)		return 0;	l->key = 1;	return 1;}