Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-05-25 18:33:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-05-25 18:33:18 +0400
commit8e599b1e3a806e4930b922840cd8756e0059fdd9 (patch)
tree7bafc65a0a6530294569cc8f302684315565e462 /winsup/cygwin/select.cc
parentdf5cda0e9332d5d82ccd56c781d9fbf368648933 (diff)
* select.cc (select_stuff::wait): When not returning after receiving
a signal, recalculate timeout. Apply temporary fix to avoid crashes after calling the signal handler. Explain.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r--winsup/cygwin/select.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 85753e817..c8d7ddb05 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -310,6 +310,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
continue;
}
+ bool gotone;
LONGLONG start_time = gtod.msecs (); /* Record the current time for later use. */
debug_printf ("m %d, ms %u", m, ms);
@@ -330,10 +331,15 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
{
case WAIT_OBJECT_0:
select_printf ("signal received");
- _my_tls.call_signal_handler ();
+ /* FIXME? Partial revert of change from 2012-01-22. If the signal
+ handler is called before the threads are stopped via cleanup,
+ emacs 24.x crashes in thread_pipe. For now, do not call the
+ signal handler if we're not in the main thread, but cleanup
+ before calling the signal handler. */
if (!return_on_signal)
- continue; /* Emulate linux behavior */
+ goto looping; /* Emulate linux behavior */
cleanup ();
+ _my_tls.call_signal_handler ();
set_sig_errno (EINTR);
return -1;
case WAIT_OBJECT_0 + 1:
@@ -361,7 +367,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
select_printf ("woke up. wait_ret %d. verifying", wait_ret);
s = &start;
- bool gotone = false;
+ gotone = false;
/* Some types of objects (e.g., consoles) wake up on "inappropriate" events
like mouse movements. The verify function will detect these situations.
If it returns false, then this wakeup was a false alarm and we should go
@@ -383,7 +389,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
cleanup ();
goto out;
}
-
+looping:
if (ms == INFINITE)
{
select_printf ("looping");