This fixes a potential race condition that might happen if two threads try to handle an exception at the same time.
LPTOP_LEVEL_EXCEPTION_FILTER mono_old_win_toplevel_exception_filter;
void *mono_win_vectored_exception_handle;
-extern gboolean mono_win_chained_exception_needs_run;
#define W32_SEH_HANDLE_EX(_ex) \
if (_ex##_handler) _ex##_handler(0, ep, sctx)
CONTEXT* ctx;
MonoContext* sctx;
LONG res;
+ MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
- mono_win_chained_exception_needs_run = FALSE;
+ jit_tls->mono_win_chained_exception_needs_run = FALSE;
res = EXCEPTION_CONTINUE_EXECUTION;
er = ep->ExceptionRecord;
break;
}
- if (mono_win_chained_exception_needs_run) {
+ if (jit_tls->mono_win_chained_exception_needs_run) {
/* Don't copy context back if we chained exception
* as the handler may have modfied the EXCEPTION_POINTERS
* directly. We don't pass sigcontext to chained handlers.
LPTOP_LEVEL_EXCEPTION_FILTER mono_old_win_toplevel_exception_filter;
gpointer mono_win_vectored_exception_handle;
-extern gboolean mono_win_chained_exception_needs_run;
extern int (*gUnhandledExceptionHandler)(EXCEPTION_POINTERS*);
#ifndef PROCESS_CALLBACK_FILTER_ENABLED
CONTEXT* ctx;
struct sigcontext* sctx;
LONG res;
+ MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
- mono_win_chained_exception_needs_run = FALSE;
+ jit_tls->mono_win_chained_exception_needs_run = FALSE;
res = EXCEPTION_CONTINUE_EXECUTION;
er = ep->ExceptionRecord;
break;
}
- if (mono_win_chained_exception_needs_run) {
+ if (jit_tls->mono_win_chained_exception_needs_run) {
/* Don't copy context back if we chained exception
* as the handler may have modfied the EXCEPTION_POINTERS
* directly. We don't pass sigcontext to chained handlers.
#include "jit-icalls.h"
-gboolean mono_win_chained_exception_needs_run;
-
void
mono_runtime_install_handlers (void)
{
gboolean
SIG_HANDLER_SIGNATURE (mono_chain_signal)
{
- mono_win_chained_exception_needs_run = TRUE;
+ MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
+ jit_tls->mono_win_chained_exception_needs_run = TRUE;
return TRUE;
}
*/
MonoContext orig_ex_ctx;
gboolean orig_ex_ctx_set;
+
+ /*
+ * Stores if we need to run a chained exception in Windows.
+ */
+ gboolean mono_win_chained_exception_needs_run;
} MonoJitTlsData;
/*