aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-09-24 17:10:21 +0000
committerChristopher Faylor <me@cgf.cx>2003-09-24 17:10:21 +0000
commit48cd7e93770469980852e5cd159299c2b2fe2a6a (patch)
tree6f89ceaf412c8ec20159695ead8d20f6d7575fcb
parent4114df05155afc462b21504f38f8c25d0bd585dd (diff)
downloadnewlib-github/cr-0x9c.zip
newlib-github/cr-0x9c.tar.gz
newlib-github/cr-0x9c.tar.bz2
* dcrt0.cc (do_exit): Eliminate "C" linkage. Call events_terminate early.github/cr-0x9ccr-0x9c
(exit_states): Move out of source file into header file. * winsup.h: Move exit_states here. Remove "C" linkage from do_exit declaration. * debug.cc (lock_debug): Remove explicit (and incorrect) external for exit_state. * sigproc.cc (sig_dispatch_pending): Don't flush signals if exiting.
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/dcrt0.cc28
-rw-r--r--winsup/cygwin/debug.cc1
-rw-r--r--winsup/cygwin/sigproc.cc2
-rw-r--r--winsup/cygwin/winsup.h18
5 files changed, 36 insertions, 24 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index f992778..dc10374 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,14 @@
+2003-09-22 Christopher Faylor <cgf@redhat.com>
+
+ * dcrt0.cc (do_exit): Eliminate "C" linkage. Call events_terminate
+ early.
+ (exit_states): Move out of source file into header file.
+ * winsup.h: Move exit_states here. Remove "C" linkage from do_exit
+ declaration.
+ * debug.cc (lock_debug): Remove explicit (and incorrect) external for
+ exit_state.
+ * sigproc.cc (sig_dispatch_pending): Don't flush signals if exiting.
+
2003-09-20 Christopher Faylor <cgf@redhat.com>
* spawn.cc (pthread_cleanup): New struct.
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 51cc55f..1933f8c 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -956,26 +956,18 @@ __main (void)
do_global_ctors (user_data->ctors, FALSE);
}
-enum exit_states
- {
- ES_NOT_EXITING = 0,
- ES_THREADTERM,
- ES_SIGNAL,
- ES_CLOSEALL,
- ES_SIGPROCTERMINATE,
- ES_TITLE,
- ES_HUP_PGRP,
- ES_HUP_SID,
- ES_TTY_TERMINATE,
- ES_EVENTS_TERMINATE
- };
-
exit_states NO_COPY exit_state;
extern CRITICAL_SECTION exit_lock;
-extern "C" void __stdcall
+void __stdcall
do_exit (int status)
{
+ if (exit_state < ES_EVENTS_TERMINATE)
+ {
+ exit_state = ES_EVENTS_TERMINATE;
+ events_terminate ();
+ }
+
EnterCriticalSection (&exit_lock);
UINT n = (UINT) status;
@@ -1059,12 +1051,6 @@ do_exit (int status)
tty_terminate ();
}
- if (exit_state < ES_EVENTS_TERMINATE)
- {
- exit_state = ES_EVENTS_TERMINATE;
- events_terminate ();
- }
-
minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
myself->exit (n);
}
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index 9628784..1b4084f 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -36,7 +36,6 @@ class lock_debug
public:
lock_debug () : acquired (0)
{
- extern int exit_state;
if (locker && !exit_state)
acquired = !!locker->acquire (INFINITE);
}
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 795c7f3..ed927ed 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -557,7 +557,7 @@ sigpending (sigset_t *set)
extern "C" int __stdcall
sig_dispatch_pending ()
{
- if (!hwait_sig || GetCurrentThreadId () == sigtid)
+ if (exit_state || !hwait_sig || GetCurrentThreadId () == sigtid)
return 0;
sigframe thisframe (mainthread);
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 55c0fe8..369f3ac 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -162,7 +162,23 @@ extern "C" int dll_dllcrt0 (HMODULE, per_process *);
extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
/* exit the program */
-extern "C" void __stdcall do_exit (int) __attribute__ ((noreturn));
+
+enum exit_states
+ {
+ ES_NOT_EXITING = 0,
+ ES_EVENTS_TERMINATE,
+ ES_THREADTERM,
+ ES_SIGNAL,
+ ES_CLOSEALL,
+ ES_SIGPROCTERMINATE,
+ ES_TITLE,
+ ES_HUP_PGRP,
+ ES_HUP_SID,
+ ES_TTY_TERMINATE
+ };
+
+extern exit_states exit_state;
+void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn));
/* UID/GID */
void uinfo_init (void);