pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.76 1998/07/16 23:46:15 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.77 1998/07/17 12:57:15 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "object.h"   #include "pike_macros.h"   #include "callback.h"
pike.git/src/threads.c:201:    (stderr, "init_threads_disable(): Disabling threads.\n"));       threads_disabled = 1;    } else {    threads_disabled++;    }       THREADS_FPRINTF(0, (stderr, "init_threads_disable(): threads_disabled:%d\n",    threads_disabled));    -  if(live_threads) -  { +  if (o) { +  /* The compiler desn't want to change thread, but doesn't mind +  * other threads running in system calls etc. +  * +  * So we only wait here if we are called with non-NULL. +  * +  * /grubba 1998-07-17 +  */ +  if(live_threads) {    SWAP_OUT_CURRENT_THREAD();    while (live_threads) {    THREADS_FPRINTF(0,    (stderr,    "_disable_threads(): Waiting for %d threads to finish\n",    live_threads));    co_wait(&live_threads_change, &interpreter_lock);    }    SWAP_IN_CURRENT_THREAD();    }    } -  + }      void exit_threads_disable(struct object *o)   {    THREADS_FPRINTF(0, (stderr, "exit_threads_disable(): threads_disabled:%d\n",    threads_disabled));    if(threads_disabled) {    if(!--threads_disabled) {    IMUTEX_T *im = (IMUTEX_T *)interleave_list;       /* Order shouldn't matter for unlock, so no need to do it backwards. */