aboutsummaryrefslogtreecommitdiff
path: root/threads_util.c
blob: d2247a2b3c3059df5074731636ac7b1a770fcef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "threads_util.h"

#if defined(__linux__)
#include <sys/prctl.h>
#endif

void thread_set_name(const char *name)
{
#if defined(__linux__)
	/* Use prctl instead to prevent using _GNU_SOURCE flag and implicit declaration */
	prctl(PR_SET_NAME, name);
#elif defined(__APPLE__) && defined(__MACH__)
	pthread_setname_np(name);
#endif
}