Branch: Tag:

2002-09-14

2002-09-14 00:57:27 by Martin Stjernholm <mast@lysator.liu.se>

Do not short-circuit check_threads if there's no yield function. That could
easily lead to starvation.

Rev: src/pike_threadlib.h:1.18
Rev: src/threads.c:1.181

1:   #include "global.h" - RCSID("$Id: threads.c,v 1.180 2002/08/15 14:49:26 marcus Exp $"); + RCSID("$Id: threads.c,v 1.181 2002/09/14 00:57:27 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;
610:      static void check_threads(struct callback *cb, void *arg, void * arg2)   { + #ifndef HAVE_NO_YIELD +  /* If we have no yield we can't cut calls here since it's possible +  * that a thread switch will take place only occasionally in the +  * window below. */   #ifdef HAVE_GETHRTIME    static long long last_;    if( gethrtime()-last_ < 50000000 ) /* 0.05s slice */
620:    if(div_++ & 255)    return;   #endif + #endif      #ifdef DEBUG    if(thread_for_id(th_self()) != Pike_interpreter.thread_id) {