summaryrefslogtreecommitdiff
path: root/rts/posix/OSThreads.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-10-10 14:26:19 +0100
committerSimon Marlow <marlowsd@gmail.com>2014-10-10 14:31:59 +0100
commit674c631ea111233daa929ef63500d75ba0db8858 (patch)
treedb42f94960c86876b73785f2c1946aeff871308e /rts/posix/OSThreads.c
parentd3f56ec6a6ead847233fee5dfad7979c2d63fc3d (diff)
downloadhaskell-674c631ea111233daa929ef63500d75ba0db8858.tar.gz
Name worker threads using pthread_setname_np
This helps identify threads in gdb particularly in processes with a lot of threads.
Diffstat (limited to 'rts/posix/OSThreads.c')
-rw-r--r--rts/posix/OSThreads.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index e627babd98..e880b891d6 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -129,11 +129,14 @@ shutdownThread(void)
}
int
-createOSThread (OSThreadId* pId, OSThreadProc *startProc, void *param)
+createOSThread (OSThreadId* pId, char *name,
+ OSThreadProc *startProc, void *param)
{
int result = pthread_create(pId, NULL, (void *(*)(void *))startProc, param);
- if(!result)
+ if (!result) {
pthread_detach(*pId);
+ pthread_setname_np(*pId, name);
+ }
return result;
}