bugfix: rwlock

This commit is contained in:
云风
2012-09-06 18:55:41 +08:00
parent 58b4bb384f
commit 5efee14582

View File

@@ -29,7 +29,7 @@ rwlock_rlock(struct rwlock *lock) {
static inline void
rwlock_wlock(struct rwlock *lock) {
__sync_lock_test_and_set(&lock->write,1);
while (__sync_lock_test_and_set(&lock->write,1)) {}
while(lock->read) {
__sync_synchronize();
}