pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c: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;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "mapping.h"   #include "object.h"   #include "pike_macros.h"
pike.git/src/threads.c:603:   }   #endif      PMOD_EXPORT int count_pike_threads(void)   {    return num_pike_threads;   }      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 */    return;    last_ = gethrtime();   #else    static int div_;    if(div_++ & 255)    return;   #endif -  + #endif      #ifdef DEBUG    if(thread_for_id(th_self()) != Pike_interpreter.thread_id) {    debug_list_all_threads();    Pike_fatal("thread_for_id() (or Pike_interpreter.thread_id) failed! %p != %p\n",thread_for_id(th_self()),Pike_interpreter.thread_id) ;    }       if(Pike_interpreter.backlink != OBJ2THREAD(Pike_interpreter.thread_id))    Pike_fatal("Hashlink is wrong!\n");   #endif