Branch: Tag:

1998-03-26

1998-03-26 14:31:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved _disable_threads().
Added THREADS_ALLOW_UID() and THREADS_DISALLOW_UID().

Rev: src/modules/files/efuns.c:1.47
Rev: src/modules/files/file.c:1.83
Rev: src/modules/files/socket.c:1.30
Rev: src/modules/spider/dumudp.c:1.36
Rev: src/modules/system/passwords.c:1.7
Rev: src/modules/system/syslog.c:1.5
Rev: src/modules/system/system.c:1.47
Rev: src/program.c:1.67
Rev: src/threads.c:1.65
Rev: src/threads.h:1.37

1:   #include "global.h" - RCSID("$Id: threads.c,v 1.64 1998/03/26 05:48:24 per Exp $"); + RCSID("$Id: threads.c,v 1.65 1998/03/26 14:30:59 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;
16:   #include "gc.h"   #include "main.h"    + int live_threads = 0; + COND_T live_threads_change; + COND_T threads_disabled_change; +    #ifdef __NT__      #ifdef DEBUG
155:   void exit_threads_disable(struct object *o)   {    if(threads_disabled) threads_disabled--; +  co_broadcast(&threads_disabled_change);   }      void init_threads_disable(struct object *o)   {    threads_disabled++; -  +  while (live_threads) { +  THREADS_FPRINTF((stderr, +  "_disable_threads(): Waiting for %d threads to finish\n", +  live_threads)); +  co_wait(&live_threads_change, &interpreter_lock);    } -  + }      /* Thread hashtable */   
723:    mt_init( & interpreter_lock);    mt_lock( & interpreter_lock);    mt_init( & thread_table_lock); +  co_init( & live_threads_change); +  co_init( & threads_disabled_change);    thread_table_init();   #ifdef POSIX_THREADS    pthread_attr_init(&pattr);