summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/posix/OSThreads.c6
-rw-r--r--rts/sm/NonMoving.c2
-rw-r--r--testsuite/tests/rts/pause-resume/pause_resume.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 44cda2626d..6e5c5999db 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -218,6 +218,12 @@ start_thread (void *param)
return startProc(startParam);
}
+/* Note: at least on Linux/Glibc, `pthread_setname_np` restricts the name of
+ * a thread to 16 bytes, including the terminating null byte. Hence, make sure
+ * to only pass in names of up to 15 characters. Otherwise,
+ * `pthread_setname_np` when called in `start_thread` will fail with `ERANGE`,
+ * which is not checked for, and the thread won't be named at all.
+ */
int
createOSThread (OSThreadId* pId, const char *name,
OSThreadProc *startProc, void *param)
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index 2697c5d2aa..3731aebb95 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -1015,7 +1015,7 @@ void nonmovingCollect(StgWeak **dead_weaks, StgTSO **resurrected_threads)
nonmoving_write_barrier_enabled = true;
debugTrace(DEBUG_nonmoving_gc, "Starting concurrent mark thread");
OSThreadId thread;
- if (createOSThread(&thread, "non-moving mark thread",
+ if (createOSThread(&thread, "nonmoving-mark",
nonmovingConcurrentMark, mark_queue) != 0) {
barf("nonmovingCollect: failed to spawn mark thread: %s", strerror(errno));
}
diff --git a/testsuite/tests/rts/pause-resume/pause_resume.c b/testsuite/tests/rts/pause-resume/pause_resume.c
index 213adf726c..969c5b1481 100644
--- a/testsuite/tests/rts/pause-resume/pause_resume.c
+++ b/testsuite/tests/rts/pause-resume/pause_resume.c
@@ -187,7 +187,7 @@ void pauseAndResumeViaThread
)
{
OSThreadId threadId;
- createOSThread(&threadId, "Pause and resume thread", &pauseAndResumeViaThread_helper, (void *)count);
+ createOSThread(&threadId, "pause-resume", &pauseAndResumeViaThread_helper, (void *)count);
}
const int TIMEOUT = 1000000; // 1 second