add assertunlocked() call
This commit is contained in:
parent
8a95f5859d
commit
25c6be64b4
2 changed files with 21 additions and 17 deletions
|
@ -39,7 +39,9 @@ rwl *initlock (void)
|
|||
void assertlocked(rwl * lock) {
|
||||
assert(lock->writers || lock->readers);
|
||||
}
|
||||
|
||||
void assertunlocked(rwl * lock) {
|
||||
assert(!(lock->writers || lock->readers));
|
||||
}
|
||||
void readlock (rwl *lock, int d)
|
||||
{
|
||||
/* printf("reader %d\n", d);
|
||||
|
|
|
@ -48,6 +48,8 @@ void writelock (rwl *lock, int d);
|
|||
int trywritelock(rwl *lock, int d);
|
||||
/** aborts if called when no thread holds this latch. */
|
||||
void assertlocked(rwl *lock);
|
||||
/** aborts if called when a thread holds this latch. */
|
||||
void assertunlocked(rwl *lock);
|
||||
void downgradelock(rwl * lock);
|
||||
void unlock(rwl * lock);
|
||||
/** @deprecated in favor of unlock() */
|
||||
|
|
Loading…
Reference in a new issue