...
 
Commits (5)
......@@ -2201,8 +2201,9 @@ PIKECLASS Backend
return -1;
}
return 1;
} else {
} else
#endif
{
/* It's actually not a problem to make this function
* reentrant, but that'd introduce a risk of races in the
* callbacks (i.e. between when a read callback is called
......
......@@ -8135,12 +8135,17 @@ PMOD_EXPORT void f_gethrtime(INT32 args)
static void f_gethrdtime(INT32 args)
{
int nsec = args && !UNSAFE_IS_ZERO(Pike_sp-args);
cpu_time_t time = threads_disabled_acc_time;
pop_n_elems(args);
cpu_time_t time;
#ifdef PIKE_THREADS
time = threads_disabled_acc_time;
if (threads_disabled) {
time += get_real_time() - threads_disabled_start;
}
#else
time = get_real_time();
#endif
pop_n_elems(args);
if (nsec) {
push_int64(time);
#ifndef LONG_CPU_TIME
......
......@@ -4580,7 +4580,9 @@ PMOD_EXPORT TYPE_FIELD real_visit_svalues (struct svalue *s, size_t num,
#define MC_WQ_START_SIZE 1024
#ifdef PIKE_THREADS
static IMUTEX_T mc_mutex;
#endif
PMOD_EXPORT int mc_pass;
PMOD_EXPORT size_t mc_counted_bytes;
......
......@@ -836,17 +836,21 @@ PMOD_EXPORT void destruct_object (struct object *o, enum object_destruct_reason
struct program *p;
struct pike_frame *pike_frame=0;
int frame_pushed = 0, destroy_called = 0;
#ifdef PIKE_THREADS
int inhibit_mask = ~THREAD_FLAG_INHIBIT |
(Pike_interpreter.thread_state?
(Pike_interpreter.thread_state->flags & THREAD_FLAG_INHIBIT):0);
#endif
#ifdef PIKE_DEBUG
ONERROR uwp;
#endif
#ifdef PIKE_THREADS
if (Pike_interpreter.thread_state) {
/* Make sure we don't exit due to signals before we're done. */
Pike_interpreter.thread_state->flags |= THREAD_FLAG_INHIBIT;
}
#endif
#ifdef PIKE_DEBUG
fatal_check_c_stack(8192);
......@@ -875,9 +879,11 @@ PMOD_EXPORT void destruct_object (struct object *o, enum object_destruct_reason
#ifdef PIKE_DEBUG
UNSET_ONERROR(uwp);
#endif
#ifdef PIKE_THREADS
if (Pike_interpreter.thread_state) {
Pike_interpreter.thread_state->flags &= inhibit_mask;
}
#endif
return;
}
add_ref( o );
......@@ -891,9 +897,11 @@ PMOD_EXPORT void destruct_object (struct object *o, enum object_destruct_reason
#ifdef PIKE_DEBUG
UNSET_ONERROR(uwp);
#endif
#ifdef PIKE_THREADS
if (Pike_interpreter.thread_state) {
Pike_interpreter.thread_state->flags &= inhibit_mask;
}
}
#endif
return;
}
destroy_called = 1;
......@@ -1006,9 +1014,11 @@ PMOD_EXPORT void destruct_object (struct object *o, enum object_destruct_reason
if( destroy_called )
remove_destroy_called_mark(o);
#ifdef PIKE_THREADS
if (Pike_interpreter.thread_state) {
Pike_interpreter.thread_state->flags &= inhibit_mask;
}
#endif
#ifdef PIKE_DEBUG
UNSET_ONERROR(uwp);
#endif
......
......@@ -8,8 +8,6 @@
/* #define PICKY_MUTEX */
#ifdef _REENTRANT
#include "pike_error.h"
/* Define to get a debug trace of thread operations. Debug levels can be 0-2. */
......@@ -75,6 +73,8 @@ PMOD_EXPORT struct Pike_interpreter_struct * pike_get_interpreter_pointer(void)
#include "pike_threadlib.h"
#endif
#ifdef _REENTRANT
#ifndef VERBOSE_THREADS_DEBUG
#define THREADS_FPRINTF(LEVEL,FPRINTF_ARGS)
#else
......