summaryrefslogtreecommitdiff
path: root/tests/test-lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-lock.c')
-rw-r--r--tests/test-lock.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/tests/test-lock.c b/tests/test-lock.c
index 7792dcaf..a992f646 100644
--- a/tests/test-lock.c
+++ b/tests/test-lock.c
@@ -1,5 +1,5 @@
/* Test of locking in multithreaded situations.
- Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
#include <config.h>
-#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WIN32_THREADS
+#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS
#if USE_POSIX_THREADS
# define TEST_POSIX_THREADS 1
@@ -29,8 +29,8 @@
#if USE_PTH_THREADS
# define TEST_PTH_THREADS 1
#endif
-#if USE_WIN32_THREADS
-# define TEST_WIN32_THREADS 1
+#if USE_WINDOWS_THREADS
+# define TEST_WINDOWS_THREADS 1
#endif
/* Whether to enable locking.
@@ -69,7 +69,7 @@
# undef USE_POSIX_THREADS
# undef USE_SOLARIS_THREADS
# undef USE_PTH_THREADS
-# undef USE_WIN32_THREADS
+# undef USE_WINDOWS_THREADS
#endif
#include "glthread/lock.h"
@@ -83,8 +83,8 @@
# if TEST_PTH_THREADS
# define USE_PTH_THREADS 1
# endif
-# if TEST_WIN32_THREADS
-# define USE_WIN32_THREADS 1
+# if TEST_WINDOWS_THREADS
+# define USE_WINDOWS_THREADS 1
# endif
#endif
@@ -143,9 +143,9 @@ lock_mutator_thread (void *arg)
{
int i1, i2, value;
- dbgprintf ("Mutator %p before lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
gl_lock_lock (my_lock);
- dbgprintf ("Mutator %p after lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after lock\n", gl_thread_self_pointer ());
i1 = random_account ();
i2 = random_account ();
@@ -153,20 +153,20 @@ lock_mutator_thread (void *arg)
account[i1] += value;
account[i2] -= value;
- dbgprintf ("Mutator %p before unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
gl_lock_unlock (my_lock);
- dbgprintf ("Mutator %p after unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after unlock\n", gl_thread_self_pointer ());
- dbgprintf ("Mutator %p before check lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
gl_lock_lock (my_lock);
check_accounts ();
gl_lock_unlock (my_lock);
- dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after check unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Mutator %p dying.\n", gl_thread_self ());
+ dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -177,16 +177,16 @@ lock_checker_thread (void *arg)
{
while (!lock_checker_done)
{
- dbgprintf ("Checker %p before check lock\n", gl_thread_self ());
+ dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
gl_lock_lock (my_lock);
check_accounts ();
gl_lock_unlock (my_lock);
- dbgprintf ("Checker %p after check unlock\n", gl_thread_self ());
+ dbgprintf ("Checker %p after check unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Checker %p dying.\n", gl_thread_self ());
+ dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -233,9 +233,9 @@ rwlock_mutator_thread (void *arg)
{
int i1, i2, value;
- dbgprintf ("Mutator %p before wrlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before wrlock\n", gl_thread_self_pointer ());
gl_rwlock_wrlock (my_rwlock);
- dbgprintf ("Mutator %p after wrlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after wrlock\n", gl_thread_self_pointer ());
i1 = random_account ();
i2 = random_account ();
@@ -243,14 +243,14 @@ rwlock_mutator_thread (void *arg)
account[i1] += value;
account[i2] -= value;
- dbgprintf ("Mutator %p before unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
gl_rwlock_unlock (my_rwlock);
- dbgprintf ("Mutator %p after unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Mutator %p dying.\n", gl_thread_self ());
+ dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -261,16 +261,16 @@ rwlock_checker_thread (void *arg)
{
while (!rwlock_checker_done)
{
- dbgprintf ("Checker %p before check rdlock\n", gl_thread_self ());
+ dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ());
gl_rwlock_rdlock (my_rwlock);
check_accounts ();
gl_rwlock_unlock (my_rwlock);
- dbgprintf ("Checker %p after check unlock\n", gl_thread_self ());
+ dbgprintf ("Checker %p after check unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Checker %p dying.\n", gl_thread_self ());
+ dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -315,9 +315,9 @@ recshuffle (void)
{
int i1, i2, value;
- dbgprintf ("Mutator %p before lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
gl_recursive_lock_lock (my_reclock);
- dbgprintf ("Mutator %p after lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after lock\n", gl_thread_self_pointer ());
i1 = random_account ();
i2 = random_account ();
@@ -329,9 +329,9 @@ recshuffle (void)
if (((unsigned int) rand () >> 3) % 2)
recshuffle ();
- dbgprintf ("Mutator %p before unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
gl_recursive_lock_unlock (my_reclock);
- dbgprintf ("Mutator %p after unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after unlock\n", gl_thread_self_pointer ());
}
static void *
@@ -343,16 +343,16 @@ reclock_mutator_thread (void *arg)
{
recshuffle ();
- dbgprintf ("Mutator %p before check lock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
gl_recursive_lock_lock (my_reclock);
check_accounts ();
gl_recursive_lock_unlock (my_reclock);
- dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ());
+ dbgprintf ("Mutator %p after check unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Mutator %p dying.\n", gl_thread_self ());
+ dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -363,16 +363,16 @@ reclock_checker_thread (void *arg)
{
while (!reclock_checker_done)
{
- dbgprintf ("Checker %p before check lock\n", gl_thread_self ());
+ dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
gl_recursive_lock_lock (my_reclock);
check_accounts ();
gl_recursive_lock_unlock (my_reclock);
- dbgprintf ("Checker %p after check unlock\n", gl_thread_self ());
+ dbgprintf ("Checker %p after check unlock\n", gl_thread_self_pointer ());
yield ();
}
- dbgprintf ("Checker %p dying.\n", gl_thread_self ());
+ dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
return NULL;
}
@@ -444,7 +444,7 @@ once_contender_thread (void *arg)
break;
dbgprintf ("Contender %p waiting for signal for round %d\n",
- gl_thread_self (), repeat);
+ gl_thread_self_pointer (), repeat);
#if ENABLE_LOCKING
/* Wait for the signal to go. */
gl_rwlock_rdlock (fire_signal[repeat]);
@@ -456,7 +456,7 @@ once_contender_thread (void *arg)
yield ();
#endif
dbgprintf ("Contender %p got the signal for round %d\n",
- gl_thread_self (), repeat);
+ gl_thread_self_pointer (), repeat);
/* Contend for execution. */
gl_once (once_control, once_execute);
@@ -495,7 +495,7 @@ test_once (void)
for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
{
/* Wait until every thread is ready. */
- dbgprintf ("Main thread before synchonizing for round %d\n", repeat);
+ dbgprintf ("Main thread before synchronizing for round %d\n", repeat);
for (;;)
{
int ready_count = 0;
@@ -509,7 +509,7 @@ test_once (void)
break;
yield ();
}
- dbgprintf ("Main thread after synchonizing for round %d\n", repeat);
+ dbgprintf ("Main thread after synchronizing for round %d\n", repeat);
if (repeat > 0)
{