pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:906:   /* This is a variant of init_threads_disable that blocks all other    * threads that might run pike code, but still doesn't block the    * THREADS_ALLOW_UID threads. */   void low_init_threads_disable(void)   {    /* Serious black magic to avoid dead-locks */       if (!threads_disabled) {    THREADS_FPRINTF(0, "low_init_threads_disable(): Locking IM's...\n");    +  lock_pike_compiler(); +     if (Pike_interpreter.thread_state) {    /* Threads have been enabled. */       IMUTEX_T *im;       THREADS_ALLOW();       /* Keep this the entire session. */    mt_lock(&interleave_lock);    -  lock_pike_compiler(); -  +     im = (IMUTEX_T *)interleave_list;       while(im) {    mt_lock(&(im->lock));       im = im->next;    }       THREADS_DISALLOW();    } else {    /* Threads haven't been enabled yet. */       IMUTEX_T *im;       /* Keep this the entire session. */    mt_lock(&interleave_lock);    -  lock_pike_compiler(); -  +     im = (IMUTEX_T *)interleave_list;       while(im) {    mt_lock(&(im->lock));       im = im->next;    }    }       THREADS_FPRINTF(0, "low_init_threads_disable(): Disabling threads.\n");