trawick 01/08/01 09:49:29
Modified: test testthread.c
Log:
get rid of vestigial !APR_HAS_THREADS logic
flush stdout before writing to stderr, as no '\n' was
written previously to the stdout buffer
Revision Changes Path
1.20 +9 -4 apr/test/testthread.c
Index: testthread.c
===================================================================
RCS file: /home/cvs/apr/test/testthread.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- testthread.c 2001/07/27 19:21:39 1.19
+++ testthread.c 2001/08/01 16:49:29 1.20
@@ -134,7 +134,6 @@
int main(void)
{
-#if APR_HAS_THREADS
apr_thread_t *t1;
apr_thread_t *t2;
apr_thread_t *t3;
@@ -148,6 +147,7 @@
fprintf(stdout, "Initializing the context.......");
if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
+ fflush(stdout);
fprintf(stderr, "could not initialize\n");
exit(-1);
}
@@ -156,6 +156,7 @@
fprintf(stdout, "Initializing the lock.......");
s1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS,
"lock.file", context);
if (s1 != APR_SUCCESS) {
+ fflush(stdout);
fprintf(stderr, "Could not create lock\n");
exit(-1);
}
@@ -168,6 +169,7 @@
s4 = apr_thread_create(&t4, NULL, thread_func4, NULL, context);
if (s1 != APR_SUCCESS || s2 != APR_SUCCESS ||
s3 != APR_SUCCESS || s4 != APR_SUCCESS) {
+ fflush(stdout);
fprintf(stderr, "Error starting thread\n");
exit(-1);
}
@@ -178,24 +180,27 @@
apr_thread_join(&s2, t2);
apr_thread_join(&s3, t3);
apr_thread_join(&s4, t4);
- fprintf (stdout, "OK\n");
+ fprintf(stdout, "OK\n");
fprintf(stdout, "Checking thread's returned value.......");
if (s1 != exit_ret_val || s2 != exit_ret_val ||
s3 != exit_ret_val || s4 != exit_ret_val) {
- fprintf(stderr, "Invalid return value (not expected value)\n");
+ fflush(stdout);
+ fprintf(stderr,
+ "Invalid return value %d/%d/%d/%d (not expected value %d)\n",
+ s1, s2, s3, s4, exit_ret_val);
exit(-1);
}
fprintf(stdout, "OK\n");
fprintf(stdout, "Checking if locks worked.......");
if (x != 40000) {
+ fflush(stdout);
fprintf(stderr, "The locks didn't work???? %d\n", x);
}
else {
fprintf(stdout, "Everything is working!\n");
}
-#endif
return 1;
}