From d4d203e3cb320a80f61231f5834b289e03667846 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2011 22:44:05 -0400 Subject: [PATCH] Fix g_rwlock_{writer,reader}_trylock --- glib/gthread-posix.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c index c002e4c..ca2703c 100644 --- a/glib/gthread-posix.c +++ b/glib/gthread-posix.c @@ -306,7 +306,10 @@ g_rw_lock_writer_lock (GRWLock *lock) gboolean g_rw_lock_writer_trylock (GRWLock *lock) { - return pthread_rwlock_trywrlock (&lock->impl); + if (pthread_rwlock_trywrlock (&lock->impl) != 0) + return FALSE; + + return TRUE; } void @@ -324,7 +327,10 @@ g_rw_lock_reader_lock (GRWLock *lock) gboolean g_rw_lock_reader_trylock (GRWLock *lock) { - return pthread_rwlock_tryrdlock (&lock->impl); + if (pthread_rwlock_tryrdlock (&lock->impl) != 0) + return FALSE; + + return TRUE; } void -- 2.7.4