pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.39 1997/09/15 12:43:23 grubba Exp $"); + RCSID("$Id: threads.c,v 1.40 1997/09/17 10:33:14 hubbe 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:25:   #endif      struct thread_starter   {    struct object *id;    struct array *args;   };      static void check_threads(struct callback *cb, void *arg, void * arg2)   { +  static int div_; +  if(div_++ & 255) return; +     THREADS_ALLOW();       /* Allow other threads to run */       THREADS_DISALLOW();   }      void *new_thread_func(void * data)   {    struct thread_starter arg = *(struct thread_starter *)data;
pike.git/src/threads.c:193:    THREADS_FPRINTF((stderr, "Recursive LOCK k:%08x, m:%08x(%08x), t:%08x\n",    (unsigned int)OB2KEY(m->key),    (unsigned int)m,    (unsigned int)OB2KEY(m->key)->mut,    (unsigned int) thread_id));    free_object(o);    error("Recursive mutex locks!\n");    }    }    +  if(m->key) +  { +  check_objects_to_destruct(); +  if(m->key) +  {    SWAP_OUT_CURRENT_THREAD(); -  while(m->key) +  do    {    THREADS_FPRINTF((stderr,"WAITING TO LOCK m:%08x\n",(unsigned int)m));    co_wait(& m->condition, & interpreter_lock); -  } +  }while(m->key);    SWAP_IN_CURRENT_THREAD(); -  +  } +  }    m->key=o;    OB2KEY(o)->mut=m;       THREADS_FPRINTF((stderr, "LOCK k:%08x, m:%08x(%08x), t:%08x\n",    (unsigned int)OB2KEY(o),    (unsigned int)m,    (unsigned int)OB2KEY(m->key)->mut,    (unsigned int)thread_id));    pop_n_elems(args);    push_object(o);