rwlock trylock functions were wrongly returning EAGAIN instead of EBUSY
authorRich Felker <dalias@aerifal.cx>
Tue, 8 Mar 2011 17:19:30 +0000 (12:19 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 8 Mar 2011 17:19:30 +0000 (12:19 -0500)
src/thread/pthread_rwlock_tryrdlock.c
src/thread/pthread_rwlock_trywrlock.c

index fc1d5328a787dc6df63db2cc265227c795e9b394..f860ec7163798ac34b5180f657cb9f4627285c86 100644 (file)
@@ -7,7 +7,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
                a_dec(&rw->_rw_readers);
                if (rw->_rw_waiters && !rw->_rw_readers)
                        __wake(&rw->_rw_readers, 1, 0);
-               return EAGAIN;
+               return EBUSY;
        }
        return 0;
 }
index 1bcf7c998f3a113773b60e8c76ed8f1b8c841db7..202e256aa0471de4e20d21696b312191e6fa703a 100644 (file)
@@ -3,10 +3,10 @@
 int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
 {
        if (a_xchg(&rw->_rw_wrlock, 1))
-               return EAGAIN;
+               return EBUSY;
        if (rw->_rw_readers) {
                a_store(&rw->_rw_wrlock, 0);
-               return EAGAIN;
+               return EBUSY;
        }
        rw->_rw_owner = pthread_self()->tid;
        return 0;