diff options
author | Sebastian Wilhelmi <wilhelmi@ira.uka.de> | 2000-04-19 09:29:19 +0000 |
---|---|---|
committer | Sebastian Wilhelmi <wilhelmi@src.gnome.org> | 2000-04-19 09:29:19 +0000 |
commit | 1383e5b64259c05b977442df2c473fa5931854a5 (patch) | |
tree | dbf95a74fd81c6b14f8686b7cb075f4e197421ea /tests | |
parent | e366512775000ce20eed18ead840de45271c2662 (diff) | |
download | glib-1383e5b64259c05b977442df2c473fa5931854a5.tar.gz |
Made the debugging G_TRYLOCK call also work for compilers with funnt
2000-04-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h (G_TRYLOCK): Made the debugging G_TRYLOCK call also work
for compilers with funnt G_STMT_(START|END) macros.
* tests/thread-test.c: Implemented a check for that.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/thread-test.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/thread-test.c b/tests/thread-test.c index 2cf30f01d..1d203df48 100644 --- a/tests/thread-test.c +++ b/tests/thread-test.c @@ -4,12 +4,14 @@ static GMutex* test_g_mutex_mutex = NULL; static guint test_g_mutex_int = 0; +G_LOCK_DEFINE_STATIC (test_g_mutex); static void test_g_mutex_thread (gpointer data) { g_assert (GPOINTER_TO_INT (data) == 42); g_assert (g_mutex_trylock (test_g_mutex_mutex) == FALSE); + g_assert (G_TRYLOCK (test_g_mutex) == FALSE); g_mutex_lock (test_g_mutex_mutex); g_assert (test_g_mutex_int == 42); g_mutex_unlock (test_g_mutex_mutex); @@ -22,11 +24,13 @@ test_g_mutex (void) test_g_mutex_mutex = g_mutex_new (); g_assert (g_mutex_trylock (test_g_mutex_mutex)); + g_assert (G_TRYLOCK (test_g_mutex)); thread = g_thread_create (test_g_mutex_thread, GINT_TO_POINTER (42), 0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL); g_usleep (G_MICROSEC); test_g_mutex_int = 42; + G_UNLOCK (test_g_mutex); g_mutex_unlock (test_g_mutex_mutex); g_thread_join (thread); g_mutex_free (test_g_mutex_mutex); |