You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@apache.org on 2002/12/06 17:06:06 UTC
cvs commit: apr/test testatomic.c
rbb 2002/12/06 08:06:06
Modified: test testatomic.c
Log:
Remove the apr_thread_once test from testatomic.c. We already test that
feature in testthread.c (using the exact same code), so it is just
confusing an already complicated test program.
Revision Changes Path
1.20 +0 -23 apr/test/testatomic.c
Index: testatomic.c
===================================================================
RCS file: /home/cvs/apr/test/testatomic.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- testatomic.c 19 Oct 2002 19:15:20 -0000 1.19
+++ testatomic.c 6 Dec 2002 16:06:06 -0000 1.20
@@ -205,7 +205,6 @@
void * APR_THREAD_FUNC thread_func_none(apr_thread_t *thd, void *data);
apr_thread_mutex_t *thread_lock;
-apr_thread_once_t *control = NULL;
volatile long x = 0; /* mutex locks */
volatile long z = 0; /* no locks */
int value = 0;
@@ -213,17 +212,10 @@
#define NUM_THREADS 50
#define NUM_ITERATIONS 20000
-static void init_func(void)
-{
- value++;
-}
-
void * APR_THREAD_FUNC thread_func_mutex(apr_thread_t *thd, void *data)
{
int i;
- apr_thread_once(control, init_func);
-
for (i = 0; i < NUM_ITERATIONS; i++) {
apr_thread_mutex_lock(thread_lock);
x++;
@@ -237,8 +229,6 @@
{
int i;
- apr_thread_once(control, init_func);
-
for (i = 0; i < NUM_ITERATIONS ; i++) {
apr_atomic_inc(&y);
apr_atomic_add(&y, 2);
@@ -253,8 +243,6 @@
{
int i;
- apr_thread_once(control, init_func);
-
for (i = 0; i < NUM_ITERATIONS ; i++) {
z++;
}
@@ -295,8 +283,6 @@
}
printf("OK\n");
- apr_thread_once_init(&control, context);
-
if (mutex == 1) {
printf("%-60s", "Initializing the lock");
rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT,
@@ -392,15 +378,6 @@
else {
printf("OK\n");
}
-
- printf("%-60s", "Checking if apr_thread_once worked");
- if (value != 1) {
- fflush(stdout);
- fprintf(stderr, "Failed!\napr_thread_once must not have worked, "
- "value is %d instead of 1\n", value);
- exit(-1);
- }
- printf("OK\n");
return 0;
}