pike.git/
src/
threads.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-08-23
2001-08-23 18:10:57 by Per Hedbor <ph@opera.com>
a85ac58ba70977b621b3e63a72da053d2ba53dd9 (
16
lines) (+
14
/-
2
)
[
Show
|
Annotate
]
Branch:
7.9
My scheduling fix from 7.2, now ported to 7.3.
Rev: src/configure.in:1.543
Rev: src/threads.c:1.161
1:
#include "global.h"
-
RCSID("$Id: threads.c,v 1.
160
2001/08/
08
14:
18:
17
leif
Exp $");
+
RCSID("$Id: threads.c,v 1.
161
2001/08/
23
18:
10:57
per
Exp $");
PMOD_EXPORT int num_threads = 1; PMOD_EXPORT int threads_disabled = 0;
586:
static void check_threads(struct callback *cb, void *arg, void * arg2) {
+
#ifdef HAVE_GETHRTIME
+
static long long last_;
+
if( gethrtime()-last_ < 50000000 ) /* 0.05s slice */
+
return;
+
last_ = gethrtime();
+
#else
static int div_;
-
if(div_++ & 255) return;
+
if(div_++ & 255)
+
return;
+
#endif
#ifdef DEBUG if(thread_for_id(th_self()) != Pike_interpreter.thread_id)
599:
THREADS_ALLOW(); /* Allow other threads to run */
+
#ifdef HAVE_THR_YIELD
+
thr_yield();
+
#endif
THREADS_DISALLOW(); #ifdef DEBUG