Commit 47ff7010 authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

Update threadCreate

 - if the name is too long, the thread name is shortened to maximum
   pthread name (16 characters).
parent 9b0bb594
...@@ -282,8 +282,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ...@@ -282,8 +282,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
ret=pthread_create(t, &attr, func, param); ret=pthread_create(t, &attr, func, param);
AssertFatal(ret == 0, "Error in pthread_create(): ret: %d, errno: %d\n", ret, errno); AssertFatal(ret == 0, "Error in pthread_create(): ret: %d, errno: %d\n", ret, errno);
pthread_setname_np(*t, name); char short_name[16];
strncpy(short_name, name, sizeof(short_name) - 1);
short_name[sizeof(short_name) - 1] = '\0';
ret = pthread_setname_np(*t, short_name);
AssertFatal(ret == 0, "Error in pthread_setname_np(): ret: %d, errno: %d\n", ret, errno);
if (affinity != -1 ) { if (affinity != -1 ) {
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment