Branch: Tag:

2009-03-13

2009-03-13 21:06:54 by Martin Stjernholm <mast@lysator.liu.se>

Reverted patch made 2001-11-02: "Keep live threads from starting when an
init_threads_disable is in progress." It could cause deadlocks between
_disable_threads and interleave mutexes if init_threads_disable is started
in another thread in the window between mt_lock(&((im)->lock)) and
THREADS_DISALLOW() in LOCK_IMUTEX.

Rev: src/pike_threadlib.h:1.69
Rev: src/threads.c:1.277

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: threads.c,v 1.276 2009/03/13 21:03:47 mast Exp $ + || $Id: threads.c,v 1.277 2009/03/13 21:06:54 mast Exp $   */      #include "global.h"
50:   #include <sys/time.h>   #endif    - PMOD_EXPORT int live_threads = 0, disallow_live_threads = 0; + PMOD_EXPORT int live_threads = 0;   PMOD_EXPORT COND_T live_threads_change;   PMOD_EXPORT COND_T threads_disabled_change;   
469:    */   void init_threads_disable(struct object *o)   { -  disallow_live_threads = 1; +  low_init_threads_disable();       if(live_threads) {    SWAP_OUT_CURRENT_THREAD();
482:    }    SWAP_IN_CURRENT_THREAD();    } -  -  low_init_threads_disable(); +    }      void exit_threads_disable(struct object *o)
506:    mt_unlock(&interleave_lock);       THREADS_FPRINTF(0, (stderr, "_exit_threads_disable(): Wake up!\n")); -  disallow_live_threads = 0; +     co_broadcast(&threads_disabled_change);   #ifdef PIKE_DEBUG    threads_disabled_thread = 0;