diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-02-23 16:56:01 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-02-23 16:56:01 +0300 |
commit | 093fe9b598738ca1e680b4e061834bc53c9a75a2 (patch) | |
tree | 3050ce674e9919b659b5e7f5c38e01a3d6633135 | |
parent | b6e4adaaf1a4248907844a32fa300ee95e71bd3c (diff) |
* cygwait.h (enum cw_wait_mask): Add cw_sig_restart. Add comments
to explain the meaning of the possible values.
* cygwait.cc (is_cw_sig_restart): Define.
(is_cw_sig_handle): Check for cw_sig_restart as well.
(cygwait): Restart always if cw_sig_restart is set.
* thread.cc (pthread::join): Call cygwait with cw_sig_restart flag
to avoid having to handle signals at all.
-rw-r--r-- | winsup/cygwin/ChangeLog | 10 | ||||
-rw-r--r-- | winsup/cygwin/cygwait.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/cygwait.h | 15 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 5 |
4 files changed, 25 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a4bb6787b..8c8e068ff 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,15 @@ 2015-02-23 Corinna Vinschen <corinna@vinschen.de> + * cygwait.h (enum cw_wait_mask): Add cw_sig_restart. Add comments + to explain the meaning of the possible values. + * cygwait.cc (is_cw_sig_restart): Define. + (is_cw_sig_handle): Check for cw_sig_restart as well. + (cygwait): Restart always if cw_sig_restart is set. + * thread.cc (pthread::join): Call cygwait with cw_sig_restart flag + to avoid having to handle signals at all. + +2015-02-23 Corinna Vinschen <corinna@vinschen.de> + * cygwait.cc (cygwait): Move setting res to WAIT_SIGNALED to clarify when WAIT_SIGNALED is returned to the caller. diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc index 4d2b8a745..71d30d164 100644 --- a/winsup/cygwin/cygwait.cc +++ b/winsup/cygwin/cygwait.cc @@ -18,8 +18,10 @@ #define is_cw_sig (mask & cw_sig) #define is_cw_sig_eintr (mask & cw_sig_eintr) #define is_cw_sig_cont (mask & cw_sig_cont) +#define is_cw_sig_restart (mask & cw_sig_restart) -#define is_cw_sig_handle (mask & (cw_sig | cw_sig_eintr | cw_sig_cont)) +#define is_cw_sig_handle (mask & (cw_sig | cw_sig_eintr \ + | cw_sig_cont | cw_sig_restart)) LARGE_INTEGER cw_nowait_storage; @@ -88,7 +90,7 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask) continue; if (is_cw_sig_eintr || (is_cw_sig_cont && sig == SIGCONT)) ; - else if (_my_tls.call_signal_handler ()) + else if (_my_tls.call_signal_handler () || is_cw_sig_restart) continue; res = WAIT_SIGNALED; /* caller will deal with signals */ } diff --git a/winsup/cygwin/cygwait.h b/winsup/cygwin/cygwait.h index 496817bcf..1240f5404 100644 --- a/winsup/cygwin/cygwait.h +++ b/winsup/cygwin/cygwait.h @@ -1,7 +1,7 @@ /* cygwait.h - Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 - Red Hat, Inc. + Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, + 2015 Red Hat, Inc. This file is part of Cygwin. @@ -16,11 +16,12 @@ enum cw_wait_mask { - cw_cancel = 0x0001, - cw_cancel_self = 0x0002, - cw_sig = 0x0004, - cw_sig_eintr = 0x0008, - cw_sig_cont = 0x0010 + cw_cancel = 0x0001, /* Cancellation point. Return to caller. */ + cw_cancel_self = 0x0002, /* Cancellation point. Cancel self. */ + cw_sig = 0x0004, /* Handle signals. */ + cw_sig_eintr = 0x0008, /* Caller handles signals. */ + cw_sig_cont = 0x0010, /* Caller handles SIGCONT. */ + cw_sig_restart = 0x0020 /* Restart even if SA_RESTART isn't set. */ }; extern LARGE_INTEGER cw_nowait_storage; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 1ac338b4b..a08a733d7 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -1,7 +1,7 @@ /* thread.cc: Locking and threading module functions Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. + 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -2399,7 +2399,8 @@ pthread::join (pthread_t *thread, void **return_val) (*thread)->attr.joinable = PTHREAD_CREATE_DETACHED; (*thread)->mutex.unlock (); - switch (cygwait ((*thread)->win32_obj_id, cw_infinite, cw_sig | cw_cancel)) + switch (cygwait ((*thread)->win32_obj_id, cw_infinite, + cw_sig | cw_sig_restart | cw_cancel)) { case WAIT_OBJECT_0: if (return_val) |