add assertunlocked() call

This commit is contained in:
Sears Russell 2009-05-30 02:22:04 +00:00
parent 8a95f5859d
commit 25c6be64b4
2 changed files with 21 additions and 17 deletions

View file

@ -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);

View file

@ -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() */