pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:454:   {    /* 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)   { -  +  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);   
pike.git/src/threads.c:481:    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,    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;       /* 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. */    res = co_wait_timeout (cond, &interpreter_lock, sec, nsec);       SET_LOCKING_THREAD;    THREADS_FPRINTF (1, (stderr,    "Got signal on cond %p with iplock" DLOC_PF(" @ ",) "\n",    cond COMMA_DLOC_ARGS_OPT));    return res;   }      static void threads_disabled_wait (DLOC_DECL)   {    assert (threads_disabled); -  +  USE_DLOC_ARGS();    do {    THREADS_FPRINTF (1, (stderr,    "Waiting on threads_disabled" DLOC_PF(" @ ",) "\n"    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"
pike.git/src/threads.c:522:   }      PMOD_EXPORT INLINE 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)   { +  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)   {    int owner = threads_disabled;    pike_low_wait_interpreter (cond COMMA_DLOC_ARGS_OPT);
pike.git/src/threads.c:580: Inside #if defined(USE_CLOCK_FOR_SLICES) and #if defined(PROFILE_CHECK_THREADS)
  #ifdef PROFILE_CHECK_THREADS    fprintf (stderr, "[%d:%f] pike_init_thread_state: tsc reset\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS));   #endif   #endif   }      PMOD_EXPORT void pike_swap_out_thread (struct thread_state *ts    COMMA_DLOC_DECL)   { +  USE_DLOC_ARGS();    THREADS_FPRINTF (2, (stderr, "Swap out %sthread %p" DLOC_PF(" @ ",) "\n",    ts == Pike_interpreter.thread_state ? "current " : "",    ts    COMMA_DLOC_ARGS_OPT));      #ifdef PROFILING    if (!ts->swapped) {    cpu_time_t now = get_cpu_time();   #ifdef PROFILING_DEBUG    fprintf(stderr, "%p: Swap out at: %" PRINT_CPU_TIME
pike.git/src/threads.c:831:    mt_lock(&((im)->lock));    pike_threads_disallow (ts COMMA_DLOC_ARGS_OPT);    THREADS_FPRINTF(1, (stderr, "Locked IMutex %p\n", im));   }      PMOD_EXPORT void pike_unlock_imutex (IMUTEX_T *im COMMA_DLOC_DECL)   {    /* If threads are disabled, we already hold the lock. */    if (threads_disabled) return;    +  USE_DLOC_ARGS();    THREADS_FPRINTF(0, (stderr, "Unlocking IMutex %p" DLOC_PF(" @ ",) "\n",    im COMMA_DLOC_ARGS_OPT));    mt_unlock(&(im->lock));   }      /* 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)   {
pike.git/src/threads.c:2996:    Pike_error("Trying to set Thread.Local without thread!\n");       if((m = Pike_interpreter.thread_state->thread_local) == NULL)    m = Pike_interpreter.thread_state->thread_local =    allocate_mapping(4);       mapping_insert(m, &key, &Pike_sp[-1]);   }      #ifdef PIKE_DEBUG - void gc_check_thread_local (struct object *o) + void gc_check_thread_local (struct object *UNUSED(o))   {    /* Only used by with locate_references. */    if (Pike_in_gc == GC_PASS_LOCATE) {    struct svalue key, *val;    struct thread_state *s;       SET_SVAL(key, T_INT, NUMBER_NUMBER, integer,    ((struct thread_local *)CURRENT_STORAGE)->id);       FOR_EACH_THREAD (s, {