[glib] Improve testcoverage in the rec-mutex test



commit fc3248065813557c37e1f5ec3442b652d4b0d404
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 4 00:44:58 2011 -0400

    Improve testcoverage in the rec-mutex test
    
    Test g_rec_mutex_trylock() in both locked and unlocked cases.

 glib/tests/rec-mutex.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c
index c8d5a35..5f3abcc 100644
--- a/glib/tests/rec-mutex.c
+++ b/glib/tests/rec-mutex.c
@@ -77,13 +77,13 @@ acquire (gint nr)
 
   self = g_thread_self ();
 
-  if (owners[nr] != NULL && owners[nr] != self)
+  if (!g_rec_mutex_trylock (&locks[nr]))
     {
       if (g_test_verbose ())
         g_print ("thread %p going to block on lock %d\n", self, nr);
-    }
 
-  g_rec_mutex_lock (&locks[nr]);
+      g_rec_mutex_lock (&locks[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]