[pypy-commit] pypy fast-gil: Move clock_gettime() below
arigo
noreply at buildbot.pypy.org
Thu Mar 6 20:32:28 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: fast-gil
Changeset: r69761:47ef34529770
Date: 2014-03-06 20:31 +0100
http://bitbucket.org/pypy/pypy/changeset/47ef34529770/
Log: Move clock_gettime() below
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
@@ -643,9 +643,8 @@
goes on. Eventually, the real GIL should be released, so there
is no point in trying to bound the maximal length of the wait.
*/
- unsigned long long delay = 100000; /* in ns; initial delay is 0.1 ms */
+ unsigned long long delay = 0;
struct timespec t;
- clock_gettime(CLOCK_REALTIME, &t);
while (1) {
@@ -672,6 +671,10 @@
}
/* sleep for a bit of time */
+ if (delay == 0) {
+ clock_gettime(CLOCK_REALTIME, &t);
+ delay = 100000; /* in ns; initial delay is 0.1 ms */
+ }
timespec_add(&t, delay);
int error = pthread_mutex_timedlock(&mutex_gil, &t);
More information about the pypy-commit
mailing list