* sigproc.cc (exit_thread): Allow to exit the thread while running
global dtors. Explain why.
This commit is contained in:
parent
8516b54215
commit
69154cfd6b
|
@ -1,3 +1,8 @@
|
||||||
|
2013-06-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* sigproc.cc (exit_thread): Allow to exit the thread while running
|
||||||
|
global dtors. Explain why.
|
||||||
|
|
||||||
2013-06-02 Corinna Vinschen <corinna@vinschen.de>
|
2013-06-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* autoload.cc (CancelSynchronousIo): Define.
|
* autoload.cc (CancelSynchronousIo): Define.
|
||||||
|
|
|
@ -447,7 +447,16 @@ exit_thread (DWORD res)
|
||||||
# undef ExitThread
|
# undef ExitThread
|
||||||
sigfillset (&_my_tls.sigmask); /* No signals wanted */
|
sigfillset (&_my_tls.sigmask); /* No signals wanted */
|
||||||
lock_process for_now; /* May block indefinitely when exiting. */
|
lock_process for_now; /* May block indefinitely when exiting. */
|
||||||
if (exit_state)
|
/* ES_EXIT_STARTING indicates that exit is in progress. After setting
|
||||||
|
exit_state to ES_EXIT_STARTING, the global dtors are running first,
|
||||||
|
then the exit state is set to the next level in do_exit. We must not
|
||||||
|
block the thread exit while the global dtors are running, because
|
||||||
|
one of them might have called pthread_join, which is perfectly valid
|
||||||
|
for a global C++ destructor.
|
||||||
|
FIXME: Do we need another state between ES_EXIT_STARTING and
|
||||||
|
ES_SIGNAL_EXIT to narrow the gap in which the thread exit
|
||||||
|
is still valid? */
|
||||||
|
if (exit_state > ES_EXIT_STARTING)
|
||||||
{
|
{
|
||||||
for_now.release ();
|
for_now.release ();
|
||||||
Sleep (INFINITE);
|
Sleep (INFINITE);
|
||||||
|
|
Loading…
Reference in New Issue