[glib] Also use trylock in the bitlock tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Also use trylock in the bitlock tests
- Date: Sat, 31 Jul 2010 06:50:06 +0000 (UTC)
commit 917456973643cfe303017f1bb3266d41bba7cfd2
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 31 02:40:16 2010 -0400
Also use trylock in the bitlock tests
gthread/tests/1bit-mutex.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gthread/tests/1bit-mutex.c b/gthread/tests/1bit-mutex.c
index abb6ddf..6c5d0cd 100644
--- a/gthread/tests/1bit-mutex.c
+++ b/gthread/tests/1bit-mutex.c
@@ -57,7 +57,13 @@ acquire (int nr)
self = g_thread_self ();
- g_bit_lock (&locks[nr], bits[nr]);
+ if (!g_bit_trylock (&locks[nr], bits[nr]))
+ {
+ if (g_test_verbose ())
+ g_print ("thread %p going to block on lock %d\n", self, nr);
+ g_bit_lock (&locks[nr], bits[nr]);
+ }
+
g_assert (owners[nr] == NULL); /* hopefully nobody else is here */
owners[nr] = self;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]