summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGHC GitLab CI <ghc-ci@gitlab-haskell.org>2020-11-26 01:06:32 +0000
committerGHC GitLab CI <ghc-ci@gitlab-haskell.org>2020-12-07 15:13:15 +0000
commit2ba6b268759c2a9dc82bd84a89017ec3190bc2f2 (patch)
tree94cd0b5172b5f8dbaecc08d00f05cd7a4c6095aa
parentde7f220342bf4d2a308ed106f34760ee99d832ab (diff)
downloadhaskell-2ba6b268759c2a9dc82bd84a89017ec3190bc2f2.tar.gz
OSThreads: Fix error code checking
pthread_join returns its error code and apparently doesn't set errno. (cherry picked from commit c488ac737e8ca3813fe6db069cbeb7abba00cfb9)
-rw-r--r--rts/posix/OSThreads.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index e5cf9e6d6a..6c09f86c7f 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -380,8 +380,9 @@ interruptOSThread (OSThreadId id)
void
joinOSThread (OSThreadId id)
{
- if (pthread_join(id, NULL) != 0) {
- sysErrorBelch("joinOSThread: error %d", errno);
+ int ret = pthread_join(id, NULL);
+ if (ret != 0) {
+ sysErrorBelch("joinOSThread: error %d", ret);
}
}