Skip to content

Commit

Permalink
fix win32 profiling regression
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored and yuyichao committed Nov 23, 2015
1 parent fdcacba commit e755087
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ int has_meta(jl_array_t *body, jl_sym_t *sym);

// backtraces
#ifdef _OS_WINDOWS_
extern volatile HANDLE hMainThread;
extern HANDLE hMainThread;
typedef CONTEXT *bt_context_t;
DWORD64 jl_getUnwindInfo(ULONG64 dwBase);
extern volatile int jl_in_stackwalk;
Expand Down
12 changes: 6 additions & 6 deletions src/signals-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void jl_throw_in_ctx(jl_value_t *excpt, CONTEXT *ctxThread, int bt)
#endif
}

volatile HANDLE hMainThread = NULL;
HANDLE hMainThread = INVALID_HANDLE_VALUE;

static BOOL WINAPI sigint_handler(DWORD wsig) //This needs winapi types to guarantee __stdcall
{
Expand Down Expand Up @@ -260,7 +260,7 @@ EXCEPTION_DISPOSITION _seh_exception_handler(PEXCEPTION_RECORD ExceptionRecord,
}
#endif

DLLEXPORT void jl_install_sigint_handler()
DLLEXPORT void jl_install_sigint_handler(void)
{
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler,1);
}
Expand Down Expand Up @@ -310,7 +310,7 @@ static DWORD WINAPI profile_bt( LPVOID lparam )
hBtThread = 0;
return 0;
}
DLLEXPORT int jl_profile_start_timer()
DLLEXPORT int jl_profile_start_timer(void)
{
running = 1;
if (hBtThread == 0) {
Expand All @@ -331,12 +331,12 @@ DLLEXPORT int jl_profile_start_timer()
}
return (hBtThread != NULL ? 0 : -1);
}
DLLEXPORT void jl_profile_stop_timer()
DLLEXPORT void jl_profile_stop_timer(void)
{
running = 0;
}

void jl_install_default_signal_handlers()
void jl_install_default_signal_handlers(void)
{
if (signal(SIGFPE, (void (__cdecl *)(int))crt_sig_handler) == SIG_ERR) {
jl_error("fatal error: Couldn't set SIGFPE");
Expand All @@ -356,7 +356,7 @@ void jl_install_default_signal_handlers()
SetUnhandledExceptionFilter(exception_handler);
}

void *jl_install_thread_signal_handler()
void *jl_install_thread_signal_handler(void)
{
// Ensure the stack overflow handler has enough space to collect the backtrace
ULONG StackSizeInBytes = sig_stack_size;
Expand Down
5 changes: 3 additions & 2 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ static void ti_init_master_thread(void)
{
#ifdef _OS_WINDOWS_
if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &jl_all_task_states[0].system_id, 0,
GetCurrentProcess(), &hMainThread, 0,
TRUE, DUPLICATE_SAME_ACCESS)) {
jl_printf(JL_STDERR, "WARNING: failed to access handle to main thread\n");
jl_all_task_states[0].system_id = INVALID_HANDLE_VALUE;
hMainThread = INVALID_HANDLE_VALUE;
}
jl_all_task_states[0].system_id = hMainThread;
#else
jl_all_task_states[0].system_id = pthread_self();
#endif
Expand Down

0 comments on commit e755087

Please sign in to comment.