Skip to content
Snippets Groups Projects
Commit fa32f2de authored by Henrik Gramner's avatar Henrik Gramner Committed by Henrik Gramner
Browse files

Set thread names on MacOS

parent 6c3e85de
No related branches found
No related tags found
1 merge request!754Set thread names on Windows and MacOS
Pipeline #8788 passed with stages
in 7 minutes and 46 seconds
......@@ -85,9 +85,14 @@ test_args = []
optional_arguments = []
# Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001)
test_args += '-D_POSIX_C_SOURCE=200112L'
test_args += '-D_POSIX_C_SOURCE=200112L'
add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c')
if host_machine.system() == 'darwin'
test_args += '-D_DARWIN_C_SOURCE'
add_project_arguments('-D_DARWIN_C_SOURCE', language: 'c')
endif
if host_machine.system() == 'windows'
cdata.set('_WIN32_WINNT', '0x0601')
cdata.set('UNICODE', 1) # Define to 1 for Unicode (Wide Chars) APIs
......
......@@ -138,10 +138,16 @@ static inline int pthread_cond_broadcast(pthread_cond_t *const cond) {
#include <sys/prctl.h>
static inline void dav1d_set_thread_name(const char* name) {
static inline void dav1d_set_thread_name(const char *const name) {
prctl(PR_SET_NAME, name);
}
#elif defined(__APPLE__)
static inline void dav1d_set_thread_name(const char *const name) {
pthread_setname_np(name);
}
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(__FreeBSD__)
......@@ -151,13 +157,13 @@ static inline void dav1d_set_thread_name(const char* name) {
#endif
#include <pthread_np.h>
static inline void dav1d_set_thread_name(const char* name) {
static inline void dav1d_set_thread_name(const char *const name) {
pthread_set_name_np(pthread_self(), name);
}
#elif defined(__NetBSD__)
static inline void dav1d_set_thread_name(const char* name) {
static inline void dav1d_set_thread_name(const char *const name) {
pthread_setname_np(pthread_self(), "%s", (void*)name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment