[glib: 3/5] glib/tests/autoptr: Also ensure that GRecMutexLocker can re-lock a mutex




commit 15d2053122eb0f2787018a9a5aeb25f26cb875f0
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Jun 23 04:42:57 2022 +0200

    glib/tests/autoptr: Also ensure that GRecMutexLocker can re-lock a mutex
    
    It's native in the actual GRecMutex, but better to check that again.

 glib/tests/autoptr.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c
index dedbe5cc9e..2806623285 100644
--- a/glib/tests/autoptr.c
+++ b/glib/tests/autoptr.c
@@ -441,12 +441,17 @@ test_g_rec_mutex_locker (void)
   if (TRUE)
     {
       g_autoptr(GRecMutexLocker) val = g_rec_mutex_locker_new (&rec_mutex);
+      g_autoptr(GRecMutexLocker) other = NULL;
 
       g_assert_nonnull (val);
 
       /* Verify that the mutex is actually locked */
       thread = g_thread_new ("rec mutex locked", rec_mutex_locked_thread, &rec_mutex);
-      g_thread_join (thread);
+      g_thread_join (g_steal_pointer (&thread));
+
+      other = g_rec_mutex_locker_new (&rec_mutex);
+      thread = g_thread_new ("rec mutex locked", rec_mutex_locked_thread, &rec_mutex);
+      g_thread_join (g_steal_pointer (&thread));
     }
 
   /* Verify that the mutex is unlocked again */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]