summaryrefslogtreecommitdiff
path: root/tests/test-lock.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-12-08 00:53:46 +0100
committerBruno Haible <bruno@clisp.org>2008-12-08 00:53:46 +0100
commit279193baa28766dc01c1d1f7605841cd420f6410 (patch)
tree732d7587f417d3489cadd421695aae3468ec3c45 /tests/test-lock.c
parentd00ad1178854d0fa16c3f7d53c0ab5f79a9eefb9 (diff)
downloadgnulib-279193baa28766dc01c1d1f7605841cd420f6410.tar.gz
Avoid gcc -Wmissing-prototypes warnings.
Diffstat (limited to 'tests/test-lock.c')
-rw-r--r--tests/test-lock.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/test-lock.c b/tests/test-lock.c
index 2708ba9f9e..58db0859c5 100644
--- a/tests/test-lock.c
+++ b/tests/test-lock.c
@@ -125,6 +125,9 @@ check_accounts (void)
abort ();
}
+
+/* ------------------- Test normal (non-recursive) locks ------------------- */
+
/* Test normal locks by having several bank accounts and several threads
which shuffle around money between the accounts and another thread
checking that all the money is still there. */
@@ -187,7 +190,7 @@ lock_checker_thread (void *arg)
return NULL;
}
-void
+static void
test_lock (void)
{
int i;
@@ -212,6 +215,9 @@ test_lock (void)
check_accounts ();
}
+
+/* ----------------- Test read-write (non-recursive) locks ----------------- */
+
/* Test read-write locks by having several bank accounts and several threads
which shuffle around money between the accounts and several other threads
that check that all the money is still there. */
@@ -268,7 +274,7 @@ rwlock_checker_thread (void *arg)
return NULL;
}
-void
+static void
test_rwlock (void)
{
int i;
@@ -295,6 +301,9 @@ test_rwlock (void)
check_accounts ();
}
+
+/* -------------------------- Test recursive locks -------------------------- */
+
/* Test recursive locks by having several bank accounts and several threads
which shuffle around money between the accounts (recursively) and another
thread checking that all the money is still there. */
@@ -367,7 +376,7 @@ reclock_checker_thread (void *arg)
return NULL;
}
-void
+static void
test_recursive_lock (void)
{
int i;
@@ -392,6 +401,9 @@ test_recursive_lock (void)
check_accounts ();
}
+
+/* ------------------------ Test once-only execution ------------------------ */
+
/* Test once-only execution by having several threads attempt to grab a
once-only task simultaneously (triggered by releasing a read-write lock). */
@@ -453,7 +465,7 @@ once_contender_thread (void *arg)
return NULL;
}
-void
+static void
test_once (void)
{
int i, repeat;
@@ -538,6 +550,9 @@ test_once (void)
gl_thread_join (threads[i], NULL);
}
+
+/* -------------------------------------------------------------------------- */
+
int
main ()
{