diff options
author | Christopher Faylor <me@cgf.cx> | 2004-02-12 03:01:58 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-02-12 03:01:58 +0000 |
commit | e431827c7cab81292e8cd4ec9d3a4a60b35a42f2 (patch) | |
tree | 1b9056071ae2ab09f0d3474904a4c5f71599128d /winsup/cygwin/cygtls.h | |
parent | 2bc01fb1f5d3166c4960c5f9a1ff617f0f46a60d (diff) | |
download | cygnal-e431827c7cab81292e8cd4ec9d3a4a60b35a42f2.tar.gz cygnal-e431827c7cab81292e8cd4ec9d3a4a60b35a42f2.tar.bz2 cygnal-e431827c7cab81292e8cd4ec9d3a4a60b35a42f2.zip |
Rename _threadinfo to _cygtls, throughout.
* cygtls.h (_cygtls::call_signal_handler): Rename from call_signal_handler_now.
(_cygtls::push): Make second argument mandatory.
(_cygtls::fixup_after_fork): Declare new function.
(_cygtls::lock): Ditto.
* cygtls.cc (_cygtls::fixup_after_fork): Define new function.
* dcrt0.cc (cygwin_finished_initializing): Define as bool.
(alloc_stack): Use _tlstop rather than arbitrary variable in probably vain
attempt to avoid strange fork problem on CTRL-C.
(dll_crt0_0): Remove obsolete winpids::init call.
* dll_init.cc (dll_dllcrt0): Detect forkee condition as equivalent to
initializing.
* winsup.h (cygwin_finished_initializing): Declare as bool.
* exceptions.cc (handle_exceptions): Rely on cygwin_finished_initializing to
determine how to handle exception during process startup.
(_cygtls::call_signal_handler): Rename from call_signal_handler_now.
(_cygtls::interrupt_now): Fill in second argument to push.
(signal_fixup_after_fork): Eliminate.
(setup_handler): Initialize locked to avoid potential inappropriate unlock.
Resume thread if it has acquired the stack lock.
(ctrl_c_handler): Just exit if ctrl-c is hit before cygiwn has finished
initializing.
* fork.cc (sync_with_child): Don't call abort since it can cause exit
deadlocks.
(sync_with_child): Change debugging output slightly.
(fork_child): Set cygwin_finished_initializing here. Call _cygtls fork fixup
and explicitly call sigproc_init.
(fork_parent): Release malloc lock on fork failure.
(vfork): Call signal handler via _my_tls.
* sigproc.cc (sig_send): Ditto.
* syscalls.cc (readv): Ditto.
* termios.cc (tcsetattr): Ditto.
* wait.cc (wait4): Ditto.
* signal.cc (nanosleep): Ditto.
(abort): Ditto.
(kill_pgrp): Avoid killing self if exiting.
* sync.cc (muto::acquire): Remove (temporarily?) ill-advised exiting_thread
check.
* gendef (_sigfe): Be more agressive in protecting stack pointer from other
access by signal thread.
(_cygtls::locked): Define new function.
(_sigbe): Ditto.
(_cygtls::pop): Protect edx.
(_cygtls::lock): Use guaranteed method to set eax to 1.
(longjmp): Aggressively protect signal stack.
* miscfuncs.cc (low_priority_sleep): Reduce "sleep time" for secs == 0.
* pinfo.cc (winpids::set): Counterintuitively use malloc's lock to protect
simultaneous access to the pids list since there are pathological conditions
which can cause malloc to call winpid.
(winpids::init): Eliminate.
* pinfo.h (winpids::cs): Eliminate declaration.
* pinfo.h (winpids::init): Eliminate definition.
Diffstat (limited to 'winsup/cygwin/cygtls.h')
-rw-r--r-- | winsup/cygwin/cygtls.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 43802dd81..78f61242b 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -90,7 +90,7 @@ struct _local_storage 'gentls_offsets' (<<-- start parsing here). */ typedef __uint32_t __stack_t; -struct _threadinfo +struct _cygtls { void (*func) /*gentls_offsets*/(int)/*gentls_offsets*/; int saved_errno; @@ -108,7 +108,7 @@ struct _threadinfo struct pthread *tid; struct _reent local_clib; struct _local_storage locals; - struct _threadinfo *prev, *next; + struct _cygtls *prev, *next; __stack_t *stackptr; int sig; unsigned stacklock; @@ -121,9 +121,9 @@ struct _threadinfo void init_thread (void *, DWORD (*) (void *, void *)); static void call (DWORD (*) (void *, void *), void *); static void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3))); - static struct _threadinfo *find_tls (int sig); + static struct _cygtls *find_tls (int sig); void remove (DWORD); - void push (__stack_t, bool = false) __attribute__ ((regparm (3))); + void push (__stack_t, bool) __attribute__ ((regparm (3))); __stack_t pop () __attribute__ ((regparm (1))); bool isinitialized () {return initialized == CYGTLS_INITIALIZED || initialized == CYGTLS_EXCEPTION;} void set_state (bool); @@ -138,16 +138,19 @@ struct _threadinfo void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3))); void set_threadkill () {threadkill = true;} void reset_threadkill () {threadkill = false;} - int lock () __attribute__ ((regparm (1))); + int call_signal_handler () __attribute__ ((regparm (1))); + void fixup_after_fork () __attribute__ ((regparm (1))); + void lock () __attribute__ ((regparm (1))); void unlock () __attribute__ ((regparm (1))); + bool locked () __attribute__ ((regparm (1))); /*gentls_offsets*/ }; #pragma pack(pop) extern char *_tlsbase __asm__ ("%fs:4"); extern char *_tlstop __asm__ ("%fs:8"); -#define _my_tls (((_threadinfo *) _tlsbase)[-1]) -extern _threadinfo *_main_tls; +#define _my_tls (((_cygtls *) _tlsbase)[-1]) +extern _cygtls *_main_tls; #define __getreent() (&_my_tls.local_clib) |