summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-09-23 04:02:07 +0000
committerChristopher Faylor <me@cgf.cx>2003-09-23 04:02:07 +0000
commit3400b4fc441b639c751592a9d40775f715fad998 (patch)
treefc1949dea9c8437ebf89f6168143cc7e88715b01 /winsup/cygwin/dcrt0.cc
parentd92d731fa51ccf56bda4ff9010d271b62f774bec (diff)
downloadcygnal-3400b4fc441b639c751592a9d40775f715fad998.tar.gz
cygnal-3400b4fc441b639c751592a9d40775f715fad998.tar.bz2
cygnal-3400b4fc441b639c751592a9d40775f715fad998.zip
* 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.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc28
1 files changed, 7 insertions, 21 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index c907399bf..470934a1b 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);
}