27 lines · 278 B · C
RawDownload
#include "u.h"#include "libc.h"#include "thread.h" static longrefadd(Ref *r, long a){	long ref; 	lock(&r->lock);	r->ref += a;	ref = r->ref;	unlock(&r->lock);	return ref;} longincref(Ref *r){	return refadd(r, 1);} longdecref(Ref *r){	return refadd(r, -1);}