X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fthread.h;h=f832c6be68c636b910a1e6f83172a0a8faaade00;hb=c712f88b26cd7547ee984b90e18c134401335bc3;hp=c8c15e5c2be9269f10123df2968ae8ddd2df38d8;hpb=e6f4c7523aa628ece995ee01879d3fb90eed6d9f;p=sbcl.git diff --git a/src/runtime/thread.h b/src/runtime/thread.h index c8c15e5..f832c6b 100644 --- a/src/runtime/thread.h +++ b/src/runtime/thread.h @@ -11,6 +11,9 @@ #ifdef LISP_FEATURE_GENCGC #include "gencgc-alloc-region.h" #endif +#ifdef LISP_FEATURE_WIN32 +#include "win32-thread-private-events.h" +#endif #include "genesis/symbol.h" #include "genesis/static-symbols.h" @@ -283,6 +286,14 @@ extern __thread struct thread *current_thread; # define THREAD_CSP_PAGE_SIZE 0 #endif +#ifdef LISP_FEATURE_WIN32 +/* + * Win32 doesn't have SIGSTKSZ, and we're not switching stacks anyway, + * so define it arbitrarily + */ +#define SIGSTKSZ 1024 +#endif + #define THREAD_STRUCT_SIZE (thread_control_stack_size + BINDING_STACK_SIZE + \ ALIEN_STACK_SIZE + \ sizeof(struct nonpointer_thread_data) + \ @@ -291,6 +302,11 @@ extern __thread struct thread *current_thread; THREAD_ALIGNMENT_BYTES + \ THREAD_CSP_PAGE_SIZE) +#if defined(LISP_FEATURE_WIN32) +static inline struct thread* arch_os_get_current_thread() + __attribute__((__const__)); +#endif + /* This is clearly per-arch and possibly even per-OS code, but we can't * put it somewhere sensible like x86-linux-os.c because it needs too * much stuff like struct thread and all_threads to be defined, which @@ -301,6 +317,10 @@ static inline struct thread *arch_os_get_current_thread(void) #if defined(LISP_FEATURE_SB_THREAD) #if defined(LISP_FEATURE_X86) register struct thread *me=0; +#if defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD) + __asm__ ("movl %%fs:0xE10+(4*63), %0" : "=r"(me) :); + return me; +#endif if(all_threads) { #if defined(LISP_FEATURE_DARWIN) && defined(LISP_FEATURE_RESTORE_FS_SEGMENT_REGISTER_FROM_TLS) sel_t sel; @@ -326,7 +346,7 @@ static inline struct thread *arch_os_get_current_thread(void) #endif return th; #endif - __asm__ __volatile__ ("movl %%fs:%c1,%0" : "=r" (me) + __asm__ ("movl %%fs:%c1,%0" : "=r" (me) : "i" (offsetof (struct thread,this))); } return me; @@ -350,9 +370,19 @@ extern kern_return_t mach_lisp_thread_destroy(struct thread *thread); #ifdef LISP_FEATURE_SB_SAFEPOINT void thread_in_safety_transition(os_context_t *ctx); void thread_in_lisp_raised(os_context_t *ctx); +void thread_interrupted(os_context_t *ctx); void thread_pitstop(os_context_t *ctxptr); extern void thread_register_gc_trigger(); +# ifdef LISP_FEATURE_SB_THRUPTION +int wake_thread(os_thread_t os_thread); +# ifdef LISP_FEATURE_WIN32 +void wake_thread_win32(struct thread *thread); +# else +int wake_thread_posix(os_thread_t os_thread); +# endif +# endif + #define thread_qrl(th) (&(th)->nonpointer_data->qrl_lock) static inline @@ -406,9 +436,10 @@ void pop_gcing_safety(struct gcing_safety *from) #define WITH_STATE_SEM(thread) \ WITH_STATE_SEM_hygenic(sbcl__state_sem, thread) +int check_pending_thruptions(os_context_t *ctx); + #endif -extern boolean is_some_thread_local_addr(os_vm_address_t addr); extern void create_initial_thread(lispobj); #ifdef LISP_FEATURE_SB_THREAD