summaryrefslogtreecommitdiff
path: root/rts/posix
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-03-10 22:55:19 -0400
committerBen Gamari <ben@smart-cactus.org>2020-10-30 00:41:14 -0400
commit4e4a73868488f83aa9d355d147e116408634c140 (patch)
tree7b54075262dcddb23db4cb1dbed9987857d5e6ba /rts/posix
parentd44f523208d32b599fa7e1260de32515d2ef9944 (diff)
downloadhaskell-4e4a73868488f83aa9d355d147e116408634c140.tar.gz
rts: Join to concurrent mark thread during shutdown
Previously we would take all capabilities but fail to join on the thread itself, potentially resulting in a leaked thread.
Diffstat (limited to 'rts/posix')
-rw-r--r--rts/posix/OSThreads.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index c51ccfcafb..6347e8ce7a 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -398,6 +398,14 @@ interruptOSThread (OSThreadId id)
pthread_kill(id, SIGPIPE);
}
+void
+joinOSThread (OSThreadId id)
+{
+ if (pthread_join(id, NULL) != 0) {
+ sysErrorBelch("joinOSThread: error %d", errno);
+ }
+}
+
KernelThreadId kernelThreadId (void)
{
#if defined(linux_HOST_OS)