| plan 9 kernel history: overview | file list | diff list |
1991/1011/port/qlock.c (diff list | history)
| 1991/1002/sys/src/9/port/qlock.c:60,62 – 1991/1011/sys/src/9/port/qlock.c:60,96 (short | long | prev | next) | ||
| 1991/1002 | q->locked = 0; unlock(&q->use); | |
| 1991/0428 | } | |
| 1991/1011 | void rlock(RWlock *l) { qlock(&l->x); /* wait here for writers and exclusion */ lock(l); l->readers++; canqlock(&l->k); /* block writers if we are the first reader */ unlock(l); qunlock(&l->x); } void runlock(RWlock *l) { lock(l); if(--l->readers == 0) /* last reader out allows writers */ qunlock(&l->k); unlock(l); } void wlock(RWlock *l) { qlock(&l->x); /* wait here for writers and exclusion */ qlock(&l->k); /* wait here for last reader */ } void wunlock(RWlock *l) { qunlock(&l->x); qunlock(&l->k); } | |