pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   /*   || 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.265 2008/09/09 16:48:50 mast Exp $ + || $Id: threads.c,v 1.266 2008/09/09 16:53:13 mast Exp $   */      #include "global.h"      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;      /* #define PICKY_MUTEX */      #ifdef _REENTRANT
pike.git/src/threads.c:878: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID), #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) and #if defined(PIKE_DEBUG)
   if (current != -1 && prctl(PR_SET_DUMPABLE, current) == -1) {   #if defined(PIKE_DEBUG)    fprintf (stderr, "%s:%d: Unexpected error from prctl(2). errno=%d\n",    __FILE__, __LINE__, errno);   #endif    }   #endif    }   #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */    -  mt_lock_interpreter(); +  /* Lock the interpreter now, but don't wait on +  * threads_disabled_change since the spawning thread might be +  * holding it. */ +  low_mt_lock_interpreter();      #if defined(PIKE_DEBUG)    if(d_flag) {    THREAD_T self = th_self();    if( !th_equal(arg.thread_state->id, self) )    Pike_fatal("Current thread is wrong. %lx %lx\n",    (long)arg.thread_state->id, (long)self);    }   #endif   
pike.git/src/threads.c:904:   #endif    Pike_interpreter.stack_top=((char *)&data)+ (thread_stack_size-16384) * STACK_DIRECTION;    Pike_interpreter.recoveries = NULL;       add_ref(thread_obj = arg.thread_state->thread_obj);    INIT_THREAD_STATE(thread_state = arg.thread_state);       /* Inform the spawning thread that we are now running. */    co_broadcast(&thread_state->status_change);    +  /* After signalling the status change to the spawning thread we may +  * now wait if threads are disabled. */ +  if (threads_disabled) { +  SWAP_OUT_CURRENT_THREAD(); +  threads_disabled_wait(); +  SWAP_IN_CURRENT_THREAD(); +  } +     DEBUG_CHECK_THREAD();       Pike_interpreter.trace_level = default_t_flag;       THREADS_FPRINTF(0, (stderr,"new_thread_func(): Thread %p inited\n",    arg.thread_state));       if(SETJMP(back))    {    if(throw_severity <= THROW_ERROR)