pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:715:    *!    *! @seealso    *! @[get_thread_quanta()], @[set_thread_quanta()]    */      /*! @endclass    */      PMOD_EXPORT void pike_threads_allow (struct thread_state *ts COMMA_DLOC_DECL)   { - #ifdef DO_PIKE_CLEANUP -  /* Might get here after th_cleanup() when reporting leaks. */ +  /* May get here after th_cleanup() when reporting leaks. */    if (!ts) return; - #endif +        if (UNLIKELY(thread_quanta > 0)) {    cpu_time_t now = get_real_time();       if (UNLIKELY((now - ts->interval_start) > thread_quanta) &&    LIKELY(ts->thread_obj)) {    ref_push_object(ts->thread_obj);    push_int64(now - ts->interval_start);    ts->interval_start = now;   #ifndef LONG_CPU_TIME
pike.git/src/threads.c:764: Inside #if defined (PIKE_DEBUG)
   pike_fatal_dloc ("Threads allowed from a different thread "    "while threads are disabled. "    "(self: %"PRINTSIZET"x, disabler: %"PRINTSIZET"x)\n",    (size_t) self, (size_t) threads_disabled_thread);    }   #endif   }      PMOD_EXPORT void pike_threads_disallow (struct thread_state *ts COMMA_DLOC_DECL)   { - #ifdef DO_PIKE_CLEANUP +  /* May get here if early init code throws errors. */    if (!ts) return; - #endif +        if (ts->swapped) {    pike_lock_interpreter (DLOC_ARGS_OPT);    pike_swap_in_thread (ts COMMA_DLOC_ARGS_OPT);    }       if (UNLIKELY(thread_quanta)) {    ts->interval_start = get_real_time();    }