trawick 01/12/02 06:02:16
Modified: test testlock.c
Log:
while on some platforms you can get away with the bug of
calling pthread_cond_timedwait() (and thus
apr_thread_cond_timedwait()) without holding the mutex,
you can't on AIX; the system recognizes the error and
returns EINVAL
so fix the testlock program to grab the mutex
Revision Changes Path
1.15 +3 -1 apr/test/testlock.c
Index: testlock.c
===================================================================
RCS file: /home/cvs/apr/test/testlock.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- testlock.c 2001/10/17 00:33:00 1.14
+++ testlock.c 2001/12/02 14:02:16 1.15
@@ -597,12 +597,14 @@
timeout = 5 * APR_USEC_PER_SEC;
for (i = 0; i < MAX_RETRY; i++) {
+ apr_thread_mutex_lock(timeout_mutex);
printf("%-60s"," Waiting for condition for 5 seconds");
begin = apr_time_now();
s = apr_thread_cond_timedwait(timeout_cond, timeout_mutex, timeout);
end = apr_time_now();
-
+ apr_thread_mutex_unlock(timeout_mutex);
+
/* If we slept for more than 100ms over the timeout. */
if (end - begin - timeout > 100000) {
if (APR_STATUS_IS_TIMEUP(s)) {