* 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.
This commit is contained in:
Christopher Faylor 2003-09-23 04:02:07 +00:00
parent d92d731fa5
commit 3400b4fc44
5 changed files with 36 additions and 24 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -36,7 +36,6 @@ class lock_debug
public:
lock_debug () : acquired (0)
{
extern int exit_state;
if (locker && !exit_state)
acquired = !!locker->acquire (INFINITE);
}

View File

@ -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);

View File

@ -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);