]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: raise: change to call pthread_kill
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 30 Jan 2019 10:36:45 +0000 (11:36 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 30 Jan 2019 10:36:45 +0000 (11:36 +0100)
POSIX requires that raise(3) is equivalent to

  pthread_kill(pthread_self(), sig);

in multi-threaded applications.  Our raise just called kill(sig).
Fix that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/release/3.0
winsup/cygwin/signal.cc

index 79affdb27a5ef8e0804e0f2435a2bb4396df3dc0..49edb38709ee32c725308112c530980c959ed18b 100644 (file)
@@ -89,3 +89,6 @@ Bug Fixes
 
 - Disallow seteuid on disabled or locked out accounts.
   Addresses: https://cygwin.com/ml/cygwin/2019-01/msg00197.html
+
+- Fix raise to work as required by POSIX.
+  (Partially) addresses: https://cygwin.com/ml/cygwin/2019-01/msg00149.html
index abefedd7b13d8aeb21e534396a25d77727695804..9c51ec129dcdd80e421379234d71911733abda7e 100644 (file)
@@ -300,7 +300,10 @@ _pinfo::kill (siginfo_t& si)
 extern "C" int
 raise (int sig)
 {
-  return kill (myself->pid, sig);
+  pthread *thread = _my_tls.tid;
+  if (!thread)
+    return kill (myself->pid, sig);
+  return pthread_kill (thread, sig);
 }
 
 static int
This page took 0.032146 seconds and 5 git commands to generate.