diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index b40d4f2abc..bb79829f50 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -3038,7 +3038,7 @@ extern char *scheme_convert_from_wchar(const wchar_t *ws); # define USE_SOCKETS_TCP #endif -extern int scheme_active_but_sleeping; +extern THREAD_LOCAL int scheme_active_but_sleeping; extern int scheme_file_open_count; typedef struct Scheme_Indexed_String { diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index 747cf3302c..6bbbbca3a9 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -153,16 +153,16 @@ void scheme_set_current_thread_ran_some() { scheme_current_thread->ran_some = 1; THREAD_LOCAL Scheme_Thread_Set *scheme_thread_set_top; -static int num_running_threads = 1; +static THREAD_LOCAL int num_running_threads = 1; #ifdef LINK_EXTENSIONS_BY_TABLE Scheme_Thread **scheme_current_thread_ptr; volatile int *scheme_fuel_counter_ptr; #endif -static int swap_no_setjmp = 0; +static THREAD_LOCAL int swap_no_setjmp = 0; -static int thread_swap_count; -static int did_gc_count; +static THREAD_LOCAL int thread_swap_count; +static THREAD_LOCAL int did_gc_count; static int init_load_on_demand = 1; @@ -215,16 +215,16 @@ void (*scheme_wakeup_on_input)(void *fds); int (*scheme_check_for_break)(void); void (*scheme_on_atomic_timeout)(void); -static int do_atomic = 0; -static int missed_context_switch = 0; -static int have_activity = 0; -int scheme_active_but_sleeping = 0; -static int thread_ended_with_activity; +static THREAD_LOCAL int do_atomic = 0; +static THREAD_LOCAL int missed_context_switch = 0; +static THREAD_LOCAL int have_activity = 0; +THREAD_LOCAL int scheme_active_but_sleeping = 0; +static THREAD_LOCAL int thread_ended_with_activity; THREAD_LOCAL int scheme_no_stack_overflow; -static int needs_sleep_cancelled; +static THREAD_LOCAL int needs_sleep_cancelled; -static int tls_pos = 0; +static THREAD_LOCAL int tls_pos = 0; #ifdef MZ_PRECISE_GC extern long GC_get_memory_use(void *c); @@ -247,15 +247,15 @@ typedef struct Thread_Cell { static Scheme_Object *read_symbol, *write_symbol, *execute_symbol, *delete_symbol, *exists_symbol; static Scheme_Object *client_symbol, *server_symbol; -static Scheme_Object *nested_exn_handler; +static THREAD_LOCAL Scheme_Object *nested_exn_handler; -static Scheme_Object *closers; +static THREAD_LOCAL Scheme_Object *closers; -static Scheme_Object *thread_swap_callbacks, *thread_swap_out_callbacks; +static THREAD_LOCAL Scheme_Object *thread_swap_callbacks, *thread_swap_out_callbacks; -static Scheme_Object *recycle_cell; -static Scheme_Object *maybe_recycle_cell; -static int recycle_cc_count; +static THREAD_LOCAL Scheme_Object *recycle_cell; +static THREAD_LOCAL Scheme_Object *maybe_recycle_cell; +static THREAD_LOCAL int recycle_cc_count; static mz_jmp_buf main_init_error_buf;