pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:413: Inside #if defined(PIKE_DEBUG)
     #if defined(PIKE_DEBUG)      /* This is a debug wrapper to enable checks that the interpreter lock    * is held by the current thread. */   static int debug_is_locked;   static THREAD_T debug_locking_thread;   #define SET_LOCKING_THREAD (debug_is_locked = 1, \    debug_locking_thread = th_self())   #define UNSET_LOCKING_THREAD (debug_is_locked = 0) - static INLINE void check_interpreter_lock (DLOC_DECL) + static void check_interpreter_lock (DLOC_DECL)   {    if (th_running) {    THREAD_T self;    if (!debug_is_locked)    pike_fatal_dloc ("Interpreter not locked.\n");    self = th_self();    if (!th_equal (debug_locking_thread, self))    pike_fatal_dloc ("Interpreter not locked by this thread.\n");    }   }
pike.git/src/threads.c:445:   static void f__check_threads_swaps (INT32 UNUSED(args))    {push_ulongest (check_threads_swaps);}      #else      #define SET_LOCKING_THREAD 0   #define UNSET_LOCKING_THREAD 0      #endif    - PMOD_EXPORT INLINE void pike_low_lock_interpreter (DLOC_DECL) + PMOD_EXPORT void pike_low_lock_interpreter (DLOC_DECL)   {    /* The double locking here is to ensure that when a thread releases    * the interpreter lock, a different thread gets it first. Thereby    * we ensure a thread switch in check_threads, if there are other    * threads waiting. */    mt_lock (&interpreter_lock_wanted);    mt_lock (&interpreter_lock);    mt_unlock (&interpreter_lock_wanted);       SET_LOCKING_THREAD;    USE_DLOC_ARGS();    THREADS_FPRINTF (1, (stderr, "Got iplock" DLOC_PF(" @ ",) "\n"    COMMA_DLOC_ARGS_OPT));   }    - PMOD_EXPORT INLINE void pike_low_wait_interpreter (COND_T *cond COMMA_DLOC_DECL) + PMOD_EXPORT void pike_low_wait_interpreter (COND_T *cond COMMA_DLOC_DECL)   {    USE_DLOC_ARGS();    THREADS_FPRINTF (1, (stderr,    "Waiting on cond %p without iplock" DLOC_PF(" @ ",) "\n",    cond COMMA_DLOC_ARGS_OPT));    UNSET_LOCKING_THREAD;       /* FIXME: Should use interpreter_lock_wanted here as well. The    * problem is that few (if any) thread libs lets us atomically    * unlock a mutex and wait, and then lock a different mutex. */    co_wait (cond, &interpreter_lock);       SET_LOCKING_THREAD;    THREADS_FPRINTF (1, (stderr,    "Got signal on cond %p with iplock" DLOC_PF(" @ ",) "\n",    cond COMMA_DLOC_ARGS_OPT));   }    - PMOD_EXPORT INLINE int pike_low_timedwait_interpreter (COND_T *cond, + PMOD_EXPORT int pike_low_timedwait_interpreter (COND_T *cond,    long sec, long nsec    COMMA_DLOC_DECL)   {    int res;    USE_DLOC_ARGS();    THREADS_FPRINTF (1, (stderr,    "Waiting on cond %p without iplock" DLOC_PF(" @ ",) "\n",    cond COMMA_DLOC_ARGS_OPT));    UNSET_LOCKING_THREAD;   
pike.git/src/threads.c:520:    COMMA_DLOC_ARGS_OPT));    UNSET_LOCKING_THREAD;    co_wait (&threads_disabled_change, &interpreter_lock);    SET_LOCKING_THREAD;    } while (threads_disabled);    THREADS_FPRINTF (1, (stderr,    "Continue after threads_disabled" DLOC_PF(" @ ",) "\n"    COMMA_DLOC_ARGS_OPT));   }    - PMOD_EXPORT INLINE void pike_lock_interpreter (DLOC_DECL) + PMOD_EXPORT void pike_lock_interpreter (DLOC_DECL)   {    pike_low_lock_interpreter (DLOC_ARGS_OPT);    if (threads_disabled) threads_disabled_wait (DLOC_ARGS_OPT);   }    - PMOD_EXPORT INLINE void pike_unlock_interpreter (DLOC_DECL) + PMOD_EXPORT void pike_unlock_interpreter (DLOC_DECL)   {    USE_DLOC_ARGS();    THREADS_FPRINTF (1, (stderr, "Releasing iplock" DLOC_PF(" @ ",) "\n"    COMMA_DLOC_ARGS_OPT));    UNSET_LOCKING_THREAD;    mt_unlock (&interpreter_lock);   }    - PMOD_EXPORT INLINE void pike_wait_interpreter (COND_T *cond COMMA_DLOC_DECL) + PMOD_EXPORT void pike_wait_interpreter (COND_T *cond COMMA_DLOC_DECL)   {    int owner = threads_disabled;    pike_low_wait_interpreter (cond COMMA_DLOC_ARGS_OPT);    if (!owner && threads_disabled) threads_disabled_wait (DLOC_ARGS_OPT);   }    - PMOD_EXPORT INLINE int pike_timedwait_interpreter (COND_T *cond, + PMOD_EXPORT int pike_timedwait_interpreter (COND_T *cond,    long sec, long nsec    COMMA_DLOC_DECL)   {    int owner = threads_disabled;    int res = pike_low_timedwait_interpreter (cond, sec, nsec    COMMA_DLOC_ARGS_OPT);    if (!owner && threads_disabled) threads_disabled_wait (DLOC_ARGS_OPT);    return res;   }