Branch: Tag:

1997-09-17

1997-09-17 10:33:14 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

threads optimized (hopefully)

Rev: src/interpret.c:1.47
Rev: src/interpret.h:1.13
Rev: src/threads.c:1.40

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;
32:      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 */
200:    }    }    +  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;