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.
This commit is contained in:
Marco Trevisan (Treviño) 2022-06-23 04:42:57 +02:00
parent e2d2db6433
commit 15d2053122

View File

@ -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 */