mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 16:26:12 +08:00
* exceptions.cc (_cygtls::call_signal_handler): Fix debugging to not go to
console. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Add temporary kludge to work around problem of make closing a handler while it is being read. * gendef (sigdelayed): Don't call a function if sig has been cleared. * sigproc.h (cygwait): Simplify slightly.
This commit is contained in:
parent
e553b822e2
commit
08e4b6acb7
@ -1,3 +1,14 @@
|
|||||||
|
2011-12-16 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
|
* exceptions.cc (_cygtls::call_signal_handler): Fix debugging to not go
|
||||||
|
to console.
|
||||||
|
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Add temporary
|
||||||
|
kludge to work around problem of make closing a handler while it is
|
||||||
|
being read.
|
||||||
|
* gendef (sigdelayed): Don't call a function if sig has been cleared.
|
||||||
|
|
||||||
|
* sigproc.h (cygwait): Simplify slightly.
|
||||||
|
|
||||||
2011-12-14 Corinna Vinschen <vinschen@redhat.com>
|
2011-12-14 Corinna Vinschen <vinschen@redhat.com>
|
||||||
|
|
||||||
* autoload.cc (GetSystemWow64DirectoryW): Define.
|
* autoload.cc (GetSystemWow64DirectoryW): Define.
|
||||||
|
@ -1330,7 +1330,7 @@ _cygtls::call_signal_handler ()
|
|||||||
_main_tls->lock ();
|
_main_tls->lock ();
|
||||||
if (_main_tls->sig && _main_tls->incyg)
|
if (_main_tls->sig && _main_tls->incyg)
|
||||||
{
|
{
|
||||||
small_printf ("Redirecting to main_tls signal %d", _main_tls->sig);
|
paranoid_printf ("Redirecting to main_tls signal %d", _main_tls->sig);
|
||||||
sig = _main_tls->sig;
|
sig = _main_tls->sig;
|
||||||
sa_flags = _main_tls->sa_flags;
|
sa_flags = _main_tls->sa_flags;
|
||||||
func = _main_tls->func;
|
func = _main_tls->func;
|
||||||
|
@ -1925,25 +1925,31 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
|
|||||||
}
|
}
|
||||||
if (res == overlapped_unknown)
|
if (res == overlapped_unknown)
|
||||||
{
|
{
|
||||||
HANDLE h = writing ? get_output_handle () : get_handle ();
|
|
||||||
DWORD wfres = cygwait (get_overlapped ()->hEvent);
|
DWORD wfres = cygwait (get_overlapped ()->hEvent);
|
||||||
/* Cancelling here to prevent races. It's possible that the I/O has
|
HANDLE h = writing ? get_output_handle () : get_handle ();
|
||||||
completed already, in which case this is a no-op. Otherwise,
|
BOOL wores;
|
||||||
WFMO returned because 1) This is a non-blocking call, 2) a signal
|
if (wfres == WAIT_OBJECT_0 + 1 && !get_overlapped ())
|
||||||
arrived, or 3) the operation was cancelled. These cases may be
|
wores = 0;
|
||||||
overridden by the return of GetOverlappedResult which could detect
|
else
|
||||||
that I/O completion occurred. */
|
{
|
||||||
CancelIo (h);
|
/* Cancelling here to prevent races. It's possible that the I/O has
|
||||||
BOOL wores = GetOverlappedResult (h, get_overlapped (), bytes, false);
|
completed already, in which case this is a no-op. Otherwise,
|
||||||
err = GetLastError ();
|
WFMO returned because 1) This is a non-blocking call, 2) a signal
|
||||||
ResetEvent (get_overlapped ()->hEvent); /* Probably not needed but CYA */
|
arrived, or 3) the operation was cancelled. These cases may be
|
||||||
debug_printf ("wfres %d, wores %d, bytes %u", wfres, wores, *bytes);
|
overridden by the return of GetOverlappedResult which could detect
|
||||||
|
that I/O completion occurred. */
|
||||||
|
CancelIo (h);
|
||||||
|
BOOL wores = GetOverlappedResult (h, get_overlapped (), bytes, false);
|
||||||
|
err = GetLastError ();
|
||||||
|
ResetEvent (get_overlapped ()->hEvent); /* Probably not needed but CYA */
|
||||||
|
debug_printf ("wfres %d, wores %d, bytes %u", wfres, wores, *bytes);
|
||||||
|
}
|
||||||
if (wores)
|
if (wores)
|
||||||
res = overlapped_success; /* operation succeeded */
|
res = overlapped_success; /* operation succeeded */
|
||||||
else if (wfres == WAIT_OBJECT_0 + 1)
|
else if (wfres == WAIT_OBJECT_0 + 1)
|
||||||
{
|
{
|
||||||
err = ERROR_INVALID_AT_INTERRUPT_TIME; /* forces an EINTR below */
|
err = ERROR_INVALID_AT_INTERRUPT_TIME; /* forces an EINTR below */
|
||||||
debug_printf ("unhandled signal");
|
debug_printf ("signal");
|
||||||
res = overlapped_error;
|
res = overlapped_error;
|
||||||
}
|
}
|
||||||
else if (nonblocking)
|
else if (nonblocking)
|
||||||
|
@ -221,6 +221,10 @@ _sigdelayed:
|
|||||||
call _yield
|
call _yield
|
||||||
jmp 1b
|
jmp 1b
|
||||||
2: incl $tls::incyg(%ebx)
|
2: incl $tls::incyg(%ebx)
|
||||||
|
movl $tls::sig(%ebx),%eax
|
||||||
|
testl %eax,%eax
|
||||||
|
jz 4f # call_signal_handler may have beat us
|
||||||
|
# to it
|
||||||
pushl $tls::saved_errno(%ebx) # saved errno
|
pushl $tls::saved_errno(%ebx) # saved errno
|
||||||
call _set_process_mask_delta
|
call _set_process_mask_delta
|
||||||
pushl %eax
|
pushl %eax
|
||||||
|
@ -87,14 +87,11 @@ cygwait (HANDLE h, DWORD howlong = INFINITE)
|
|||||||
HANDLE w4[3];
|
HANDLE w4[3];
|
||||||
DWORD n = 0;
|
DWORD n = 0;
|
||||||
DWORD wait_signal;
|
DWORD wait_signal;
|
||||||
if ((w4[n] = h) == NULL)
|
if ((w4[n] = h) != NULL)
|
||||||
|
wait_signal = WAIT_OBJECT_0 + ++n;
|
||||||
|
else
|
||||||
wait_signal = WAIT_OBJECT_0 + 15; /* Arbitrary. Don't call signal
|
wait_signal = WAIT_OBJECT_0 + 15; /* Arbitrary. Don't call signal
|
||||||
handler if only waiting for signal */
|
handler if only waiting for signal */
|
||||||
else
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
wait_signal = n;
|
|
||||||
}
|
|
||||||
w4[n++] = signal_arrived;
|
w4[n++] = signal_arrived;
|
||||||
if ((w4[n] = pthread::get_cancel_event ()) != NULL)
|
if ((w4[n] = pthread::get_cancel_event ()) != NULL)
|
||||||
n++;
|
n++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user