Skip to content

Commit

Permalink
thread: fix freebsd pthread_setname_np handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Mar 24, 2023
1 parent 53a623c commit 9d1b8d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/thread/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


struct thread {
thrd_t *thr;
const char *name;
thrd_start_t func;
void *arg;
Expand Down Expand Up @@ -76,8 +77,10 @@ static int handler(void *p)
(void)SetThreadDescription(GetCurrentThread(), name);
mem_deref(name);
}
#elif defined(HAVE_PTHREAD)
#elif defined(DARWIN)
(void)pthread_setname_np(th.name);
#elif defined(HAVE_PTHREAD)
(void)pthread_setname_np(th.thr, th.name);
#endif

return th.func(th.arg);
Expand All @@ -97,6 +100,7 @@ int thread_create_name(thrd_t *thr, const char *name, thrd_start_t func,
if (!th)
return ENOMEM;

th->thr = thr;
th->name = name;
th->func = func;
th->arg = arg;
Expand Down

0 comments on commit 9d1b8d2

Please sign in to comment.