[glib] Fix g_rwlock_{writer,reader}_trylock
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix g_rwlock_{writer,reader}_trylock
- Date: Fri, 23 Sep 2011 02:46:23 +0000 (UTC)
commit d4d203e3cb320a80f61231f5834b289e03667846
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Sep 22 22:44:05 2011 -0400
Fix g_rwlock_{writer,reader}_trylock
glib/gthread-posix.c | 10 ++++++++--
1 files 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]