Russ Coxa934846f21 years agoHistory
39 lines · 634 B · C
RawDownload
#include "u.h"#include "lib.h"#include "dat.h"#include "fns.h"#include "error.h" voidrlock(RWlock *l){	qlock(&l->x);		/* wait here for writers and exclusion */	lock(&l->lk);	l->readers++;	canqlock(&l->k);	/* block writers if we are the first reader */	unlock(&l->lk);	qunlock(&l->x);} voidrunlock(RWlock *l){	lock(&l->lk);	if(--l->readers == 0)	/* last reader out allows writers */		qunlock(&l->k);	unlock(&l->lk);} voidwlock(RWlock *l){	qlock(&l->x);		/* wait here for writers and exclusion */	qlock(&l->k);		/* wait here for last reader */} voidwunlock(RWlock *l){	qunlock(&l->k);	qunlock(&l->x);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t