mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
Improve testcoverage in the rec-mutex test
Test g_rec_mutex_trylock() in both locked and unlocked cases.
This commit is contained in:
parent
823e32655e
commit
fc32480658
@ -77,13 +77,13 @@ acquire (gint nr)
|
|||||||
|
|
||||||
self = g_thread_self ();
|
self = g_thread_self ();
|
||||||
|
|
||||||
if (owners[nr] != NULL && owners[nr] != self)
|
if (!g_rec_mutex_trylock (&locks[nr]))
|
||||||
{
|
{
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_print ("thread %p going to block on lock %d\n", self, nr);
|
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 */
|
g_assert (owners[nr] == NULL); /* hopefully nobody else is here */
|
||||||
owners[nr] = self;
|
owners[nr] = self;
|
||||||
|
Loading…
Reference in New Issue
Block a user