Branch: Tag:

2001-11-01

2001-11-01 18:40:12 by Martin Stjernholm <mast@lysator.liu.se>

Fixed some bugs with VERBOSE_THREADS_DEBUG. Added some debug to better
detect thread switches while threads_disabled is set.

Rev: src/pike_threadlib.h:1.10
Rev: src/threads.c:1.172
Rev: src/threads.h:1.117

1:   #include "global.h" - RCSID("$Id: threads.c,v 1.171 2001/11/01 18:10:28 mast Exp $"); + RCSID("$Id: threads.c,v 1.172 2001/11/01 18:40:12 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;
179: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG   int debug_interpreter_is_locked = 0;   THREAD_T debug_locking_thread; + THREAD_T threads_disabled_thread = 0;   #endif   PMOD_EXPORT MUTEX_T interpreter_lock;   MUTEX_T thread_table_lock, interleave_lock;
255:    "low_init_threads_disable(): Disabling threads.\n"));       threads_disabled = 1; + #ifdef PIKE_DEBUG +  threads_disabled_thread = th_self(); + #endif    } else {    threads_disabled++;    }
304:    while(im) {    THREADS_FPRINTF(0,    (stderr, -  "exit_threads_disable(): Unlocking IM 0x%08p\n", im)); +  "exit_threads_disable(): Unlocking IM 0x%p\n", im));    mt_unlock(&(im->lock));    im = im->next;    }
313:       THREADS_FPRINTF(0, (stderr, "_exit_threads_disable(): Wake up!\n"));    co_broadcast(&threads_disabled_change); + #ifdef PIKE_DEBUG +  threads_disabled_thread = 0; + #endif    }   #ifdef PIKE_DEBUG    } else {
331:    init_threads_disable(NULL);       THREADS_FPRINTF(0, (stderr, -  "init_interleave_mutex(): Locking IM 0x%08p\n", im)); +  "init_interleave_mutex(): Locking IM 0x%p\n", im));       /* Lock it so that it can be unlocked by exit_threads_disable() */    mt_lock(&(im->lock));