Author: Armin Rigo <[email protected]>
Branch:
Changeset: r72255:d617093b49a1
Date: 2014-06-27 23:12 +0200
http://bitbucket.org/pypy/pypy/changeset/d617093b49a1/
Log: Untested, fix attempt for OS/X
diff --git a/rpython/translator/c/src/thread_pthread.c
b/rpython/translator/c/src/thread_pthread.c
--- a/rpython/translator/c/src/thread_pthread.c
+++ b/rpython/translator/c/src/thread_pthread.c
@@ -508,7 +508,14 @@
}
static inline int mutex_lock_timeout(mutex_t *mutex, double delay) {
struct timespec t;
+#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0
clock_gettime(CLOCK_REALTIME, &t);
+#else
+ struct timeval tv;
+ RPY_GETTIMEOFDAY(&tv);
+ t.tv_sec = tv.tv_sec;
+ t.tv_nsec = tv.tv_usec * 1000 + 999;
+#endif
timespec_add(&t, delay);
int error_from_timedlock = pthread_mutex_timedlock(mutex, &t);
if (error_from_timedlock == ETIMEDOUT)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit