Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59130:2919c69062e0
Date: 2012-11-29 20:32 +0100
http://bitbucket.org/pypy/pypy/changeset/2919c69062e0/
Log: Fix compilation and translation.
diff --git a/pypy/translator/c/src/thread_pthread.c
b/pypy/translator/c/src/thread_pthread.c
--- a/pypy/translator/c/src/thread_pthread.c
+++ b/pypy/translator/c/src/thread_pthread.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <errno.h>
#include <assert.h>
+#include <sys/time.h>
/* The following is hopefully equivalent to what CPython does
(which is trying to compile a snippet of code using it) */
@@ -170,6 +171,29 @@
#endif
}
+#ifdef GETTIMEOFDAY_NO_TZ
+#define RPY_GETTIMEOFDAY(ptv) gettimeofday(ptv)
+#else
+#define RPY_GETTIMEOFDAY(ptv) gettimeofday(ptv, (struct timezone *)NULL)
+#endif
+
+#define RPY_MICROSECONDS_TO_TIMESPEC(microseconds, ts) \
+do { \
+ struct timeval tv; \
+ RPY_GETTIMEOFDAY(&tv); \
+ tv.tv_usec += microseconds % 1000000; \
+ tv.tv_sec += microseconds / 1000000; \
+ tv.tv_sec += tv.tv_usec / 1000000; \
+ tv.tv_usec %= 1000000; \
+ ts.tv_sec = tv.tv_sec; \
+ ts.tv_nsec = tv.tv_usec * 1000; \
+} while(0)
+
+int RPyThreadAcquireLock(struct RPyOpaque_ThreadLock *lock, int waitflag)
+{
+ return RPyThreadAcquireLockTimed(lock, waitflag ? -1 : 0, /*intr_flag=*/0);
+}
+
/************************************************************/
#ifdef USE_SEMAPHORES
/************************************************************/
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit