Cygwin: signalfd: implement non-polling select
Allow the signal thread to recognize we're called in consequence of select on a signalfd. If the signal is part of the wait mask, don't call any signal handler and don't remove the signal from the queue, so a subsequent read (or sigwaitinfo/sigtimedwait) still gets the signal. Instead, just signal the event object at _cygtls::signalfd_select_wait for the thread running select. The addition of signalfd_select_wait to _cygtls unearthed the alignment problem of the context member again. To make sure this doesn't get lost, improve the related comment in the header file so that this (hopefully) doesn't get lost (again). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@@ -66,6 +66,12 @@ struct select_serial_info: public select_info
|
||||
select_serial_info (): select_info () {}
|
||||
};
|
||||
|
||||
struct select_signalfd_info: public select_info
|
||||
{
|
||||
HANDLE evt;
|
||||
select_signalfd_info (): select_info () {}
|
||||
};
|
||||
|
||||
class select_stuff
|
||||
{
|
||||
public:
|
||||
@@ -85,6 +91,7 @@ public:
|
||||
select_pipe_info *device_specific_pipe;
|
||||
select_socket_info *device_specific_socket;
|
||||
select_serial_info *device_specific_serial;
|
||||
select_signalfd_info *device_specific_signalfd;
|
||||
|
||||
bool test_and_set (int, fd_set *, fd_set *, fd_set *);
|
||||
int poll (fd_set *, fd_set *, fd_set *);
|
||||
@@ -93,10 +100,11 @@ public:
|
||||
void destroy ();
|
||||
|
||||
select_stuff (): return_on_signal (false), always_ready (false),
|
||||
windows_used (false), start (0),
|
||||
windows_used (false), start (),
|
||||
device_specific_pipe (NULL),
|
||||
device_specific_socket (NULL),
|
||||
device_specific_serial (NULL) {}
|
||||
device_specific_serial (NULL),
|
||||
device_specific_signalfd (NULL) {}
|
||||
};
|
||||
|
||||
extern "C" int cygwin_select (int , fd_set *, fd_set *, fd_set *,
|
||||
|
Reference in New Issue
Block a user