aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-06-27 18:13:38 +0200
committerCorinna Vinschen <corinna@vinschen.de>2018-06-27 18:19:18 +0200
commitcb3ddf9e2ac1ca094cc0818188248fe10811fa19 (patch)
tree7d4bceafa8730ac77844b211fc29b4a05ab03c7c /winsup/cygwin
parent732e0b395ddad021a9667aecca6a387e8a8a598d (diff)
downloadnewlib-cb3ddf9e2ac1ca094cc0818188248fe10811fa19.zip
newlib-cb3ddf9e2ac1ca094cc0818188248fe10811fa19.tar.gz
newlib-cb3ddf9e2ac1ca094cc0818188248fe10811fa19.tar.bz2
Cygwin: pthread_timedjoin_np: return ETIMEDOUT, not EBUSY
pthread_timedjoin_np returns ETIMEDOUT if a thread is still running, not EBUSY as pthread_tryjoin_np. Also, clean up initializing timeout in pthread_tryjoin_np. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/thread.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 2734d17..2cbdcf5 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -2472,7 +2472,7 @@ pthread::join (pthread_t *thread, void **return_val, PLARGE_INTEGER timeout)
// set joined thread back to joinable since we got canceled
(*thread)->joiner = NULL;
(*thread)->attr.joinable = PTHREAD_CREATE_JOINABLE;
- return EBUSY;
+ return (timeout && timeout->QuadPart == 0LL) ? EBUSY : ETIMEDOUT;
default:
// should never happen
return EINVAL;
@@ -2588,7 +2588,7 @@ pthread_join (pthread_t thread, void **return_val)
extern "C" int
pthread_tryjoin_np (pthread_t thread, void **return_val)
{
- LARGE_INTEGER timeout = { 0, 0 };
+ LARGE_INTEGER timeout = { QuadPart:0LL };
return pthread::join (&thread, (void **) return_val, &timeout);
}