Commit 9c4f6928 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Exceptions: Attempt to keep threads_disabled state consistent.

parent 56f84a65
...@@ -544,6 +544,10 @@ PMOD_EXPORT DECLSPEC(noreturn) void debug_va_fatal(const char *fmt, va_list args ...@@ -544,6 +544,10 @@ PMOD_EXPORT DECLSPEC(noreturn) void debug_va_fatal(const char *fmt, va_list args
* below. Doing it the naughty way without going through * below. Doing it the naughty way without going through
* init_threads_disable etc to avoid hanging on runaway locks. */ * init_threads_disable etc to avoid hanging on runaway locks. */
#ifdef PIKE_THREADS #ifdef PIKE_THREADS
#ifdef PIKE_DEBUG
THREAD_T save_threads_disabled_thread = threads_disabled_thread;
threads_disabled_thread = th_self();
#endif
threads_disabled++; threads_disabled++;
#endif #endif
memset (&evaluator_callbacks, 0, sizeof (evaluator_callbacks)); memset (&evaluator_callbacks, 0, sizeof (evaluator_callbacks));
...@@ -559,6 +563,9 @@ PMOD_EXPORT DECLSPEC(noreturn) void debug_va_fatal(const char *fmt, va_list args ...@@ -559,6 +563,9 @@ PMOD_EXPORT DECLSPEC(noreturn) void debug_va_fatal(const char *fmt, va_list args
UNSETJMP (jmp); UNSETJMP (jmp);
#ifdef PIKE_THREADS #ifdef PIKE_THREADS
threads_disabled--; threads_disabled--;
#ifdef PIKE_DEBUG
threads_disabled_thread = save_threads_disabled_thread;
#endif
#endif #endif
evaluator_callbacks = saved_eval_cbs; evaluator_callbacks = saved_eval_cbs;
}else{ }else{
......
...@@ -668,6 +668,9 @@ PMOD_EXPORT void pike_threads_disallow_ext (struct thread_state *ts ...@@ -668,6 +668,9 @@ PMOD_EXPORT void pike_threads_disallow_ext (struct thread_state *ts
#ifndef PIKE_THREADS #ifndef PIKE_THREADS
#define THREAD_T void *
#define THREAD_T_IS_POINTER
#define th_atfork(X,Y,Z) #define th_atfork(X,Y,Z)
#define th_atfork_prepare() #define th_atfork_prepare()
#define th_atfork_parent() #define th_atfork_parent()
...@@ -744,4 +747,8 @@ PMOD_EXPORT HANDLE CheckValidHandle(HANDLE h); ...@@ -744,4 +747,8 @@ PMOD_EXPORT HANDLE CheckValidHandle(HANDLE h);
#endif /* PIKE_THREAD_T_IS_POINTER */ #endif /* PIKE_THREAD_T_IS_POINTER */
#endif /* !THREAD_T_TO_PTR */ #endif /* !THREAD_T_TO_PTR */
#ifdef PIKE_DEBUG
extern THREAD_T threads_disabled_thread;
#endif
#endif /* PIKE_THREADLIB_H */ #endif /* PIKE_THREADLIB_H */
...@@ -386,7 +386,8 @@ PMOD_EXPORT cpu_time_t threads_disabled_acc_time = 0; ...@@ -386,7 +386,8 @@ PMOD_EXPORT cpu_time_t threads_disabled_acc_time = 0;
PMOD_EXPORT cpu_time_t threads_disabled_start = 0; PMOD_EXPORT cpu_time_t threads_disabled_start = 0;
#ifdef PIKE_DEBUG #ifdef PIKE_DEBUG
static THREAD_T threads_disabled_thread = 0; /* NB: Accessed from error.c:debug_va_fatal(). */
extern THREAD_T threads_disabled_thread = 0;
#endif #endif
#ifdef INTERNAL_PROFILING #ifdef INTERNAL_PROFILING
PMOD_EXPORT unsigned long thread_yields = 0; PMOD_EXPORT unsigned long thread_yields = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment