apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: watch out for thread_cond_timedwait problems
Date Tue, 02 Jul 2002 14:40:19 GMT
On Tue, 2002-07-02 at 06:39, Jeff Trawick wrote:
> I dunno what the cause is yet, but I'm getting testlock failures for
> the last day or so.

I made one recent change to apr_thread_cond_timedwait():

@@ -133,8 +133,8 @@
     struct timespec abstime;
 
     then = apr_time_now() + timeout;
-    abstime.tv_sec = then / APR_USEC_PER_SEC;
-    abstime.tv_nsec = (then % APR_USEC_PER_SEC) * 1000; /* nanoseconds
*/
+    abstime.tv_sec = apr_time_sec(then);
+    abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
 
     rv = pthread_cond_timedwait(cond->cond, &mutex->mutex, &abstime);
 #ifdef PTHREAD_SETS_ERRNO


The new version should be equivalent to the old one, unless the
cast to apr_int32_t in apr_time_usec is causing problems on 64-bit
platforms.

--Brian



Mime
View raw message