From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81342 invoked by alias); 27 Jun 2018 16:24:52 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 64595 invoked by uid 9078); 27 Jun 2018 16:24:24 -0000 Date: Wed, 27 Jun 2018 16:24:00 -0000 Message-ID: <20180627162424.64592.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pthread_timedjoin_np: return ETIMEDOUT, not EBUSY X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 732e0b395ddad021a9667aecca6a387e8a8a598d X-Git-Newrev: cb3ddf9e2ac1ca094cc0818188248fe10811fa19 X-SW-Source: 2018-q2/txt/msg00028.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cb3ddf9e2ac1ca094cc0818188248fe10811fa19 commit cb3ddf9e2ac1ca094cc0818188248fe10811fa19 Author: Corinna Vinschen Date: Wed Jun 27 18:13:38 2018 +0200 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 Diff: --- winsup/cygwin/thread.cc | 4 ++-- 1 file 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); }