[pypy-commit] pypy stmgc-c8: import stmgc/7592a0f11ac2
arigo
noreply at buildbot.pypy.org
Thu Jun 18 11:45:40 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8
Changeset: r78171:eeb45349ea15
Date: 2015-06-18 10:45 +0100
http://bitbucket.org/pypy/pypy/changeset/eeb45349ea15/
Log: import stmgc/7592a0f11ac2
diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-3ca830828468
+7592a0f11ac2
diff --git a/rpython/translator/stm/src_stm/stm/sync.c b/rpython/translator/stm/src_stm/stm/sync.c
--- a/rpython/translator/stm/src_stm/stm/sync.c
+++ b/rpython/translator/stm/src_stm/stm/sync.c
@@ -115,7 +115,12 @@
t->tv_sec = tv.tv_sec;
t->tv_nsec = tv.tv_usec * 1000 + 999;
#endif
- /* assumes that "incr" is not too large, less than 1 second */
+
+ long integral_part = (long)incr;
+ t->tv_sec += integral_part;
+ incr -= integral_part;
+ assert(incr >= 0.0 && incr <= 1.0);
+
long nsec = t->tv_nsec + (long)(incr * 1000000000.0);
if (nsec >= 1000000000) {
t->tv_sec += 1;
@@ -131,15 +136,21 @@
stm_fatalerror("*** cond_wait/%d called!", (int)ctype);
#endif
+ retry:
assert(_has_mutex_here);
int err = pthread_cond_timedwait(&sync_ctl.cond[ctype],
&sync_ctl.global_mutex, pt);
- if (err == 0)
+ switch (err) {
+ case 0:
return true; /* success */
- if (LIKELY(err == ETIMEDOUT))
+ case ETIMEDOUT:
return false; /* timeout */
- stm_fatalerror("pthread_cond_timedwait/%d: %d", (int)ctype, err);
+ case EINTR:
+ goto retry;
+ default:
+ stm_fatalerror("pthread_cond_timedwait/%d: %d", (int)ctype, err);
+ }
}
static bool cond_wait_timeout(enum cond_type_e ctype, double delay)
More information about the pypy-commit
mailing list