* sigproc.h (no_thread_exit_protect): New class.
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if we need to coordinate ThreadExit/ExitProcess. * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use no_thread_exit_protect to kludge around waiting for waveOutClose as it waits for a thread that never exits. (fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose.
This commit is contained in:
parent
2e6ce0ebdc
commit
e86fa3ae83
|
@ -1,3 +1,13 @@
|
||||||
|
2014-03-17 Christopher Faylor <me.cygwin2014@cgf.cx>
|
||||||
|
|
||||||
|
* sigproc.h (no_thread_exit_protect): New class.
|
||||||
|
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if
|
||||||
|
we need to coordinate ThreadExit/ExitProcess.
|
||||||
|
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use
|
||||||
|
no_thread_exit_protect to kludge around waiting for waveOutClose as it
|
||||||
|
waits for a thread that never exits.
|
||||||
|
(fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose.
|
||||||
|
|
||||||
2014-03-16 Christopher Faylor <me.cygwin2014@cgf.cx>
|
2014-03-16 Christopher Faylor <me.cygwin2014@cgf.cx>
|
||||||
|
|
||||||
* fhandler.h (fhandler_dev_dsp::base): New method.
|
* fhandler.h (fhandler_dev_dsp::base): New method.
|
||||||
|
|
|
@ -435,6 +435,7 @@ fhandler_dev_dsp::Audio_out::stop (bool immediately)
|
||||||
debug_printf ("%u = waveOutUnprepareHeader(%p)", rc, pHdr);
|
debug_printf ("%u = waveOutUnprepareHeader(%p)", rc, pHdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_thread_exit_protect for_now (true);
|
||||||
rc = waveOutClose (dev_);
|
rc = waveOutClose (dev_);
|
||||||
debug_printf ("%u = waveOutClose()", rc);
|
debug_printf ("%u = waveOutClose()", rc);
|
||||||
|
|
||||||
|
@ -810,6 +811,7 @@ fhandler_dev_dsp::Audio_in::stop ()
|
||||||
debug_printf ("%u = waveInUnprepareHeader(%p)", rc, pHdr);
|
debug_printf ("%u = waveInUnprepareHeader(%p)", rc, pHdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_thread_exit_protect for_now (true);
|
||||||
rc = waveInClose (dev_);
|
rc = waveInClose (dev_);
|
||||||
debug_printf ("%u = waveInClose()", rc);
|
debug_printf ("%u = waveInClose()", rc);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ struct sigaction *global_sigs;
|
||||||
const char *__sp_fn ;
|
const char *__sp_fn ;
|
||||||
int __sp_ln;
|
int __sp_ln;
|
||||||
|
|
||||||
|
bool no_thread_exit_protect::flag;
|
||||||
|
|
||||||
char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes to
|
char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes to
|
||||||
// current process but no wait is required
|
// current process but no wait is required
|
||||||
|
|
||||||
|
@ -446,6 +448,8 @@ void
|
||||||
exit_thread (DWORD res)
|
exit_thread (DWORD res)
|
||||||
{
|
{
|
||||||
# undef ExitThread
|
# undef ExitThread
|
||||||
|
if (no_thread_exit_protect ())
|
||||||
|
ExitThread (res);
|
||||||
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. */
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
@ -465,7 +469,7 @@ exit_thread (DWORD res)
|
||||||
siginfo_t si = {__SIGTHREADEXIT, SI_KERNEL};
|
siginfo_t si = {__SIGTHREADEXIT, SI_KERNEL};
|
||||||
si.si_cyg = h;
|
si.si_cyg = h;
|
||||||
sig_send (myself_nowait, si, &_my_tls);
|
sig_send (myself_nowait, si, &_my_tls);
|
||||||
ExitThread (0);
|
ExitThread (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __reg3
|
int __reg3
|
||||||
|
|
|
@ -83,6 +83,22 @@ int kill_pgrp (pid_t, siginfo_t&);
|
||||||
void __reg1 exit_thread (DWORD) __attribute__ ((noreturn));
|
void __reg1 exit_thread (DWORD) __attribute__ ((noreturn));
|
||||||
void __reg1 setup_signal_exit (int);
|
void __reg1 setup_signal_exit (int);
|
||||||
|
|
||||||
|
class no_thread_exit_protect
|
||||||
|
{
|
||||||
|
static bool flag;
|
||||||
|
bool modify;
|
||||||
|
public:
|
||||||
|
no_thread_exit_protect (int) {flag = true; modify = true;}
|
||||||
|
~no_thread_exit_protect ()
|
||||||
|
{
|
||||||
|
if (modify)
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
no_thread_exit_protect () {modify = false;}
|
||||||
|
operator int () {return flag;}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
extern "C" void sigdelayed ();
|
extern "C" void sigdelayed ();
|
||||||
|
|
||||||
extern char myself_nowait_dummy[];
|
extern char myself_nowait_dummy[];
|
||||||
|
|
Loading…
Reference in New Issue