mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-02 19:26:43 +00:00
Thread api, macOS implementation completion. ##core
This commit is contained in:
parent
89325449d5
commit
0c40abc00d
@ -23,6 +23,9 @@
|
||||
#else
|
||||
#define HAVE_PTHREAD_NP 1
|
||||
#endif
|
||||
#if __APPLE__
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#if __FreeBSD__ || __OpenBSD__ || __DragonFly__
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
@ -539,6 +539,8 @@ R_API int r_sys_thp_mode(void) {
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,11 @@ R_API bool r_th_setname(RThread *th, const char *name) {
|
||||
eprintf ("Failed to set thread name\n");
|
||||
return false;
|
||||
}
|
||||
#elif __APPLE__
|
||||
if (pthread_setname_np (name) != 0) {
|
||||
eprintf ("Failed to set thread name\n");
|
||||
return false;
|
||||
}
|
||||
#elif __FreeBSD__ || __OpenBSD__ || __DragonFly__
|
||||
pthread_set_name_np (th->tid, name);
|
||||
#elif __NetBSD__
|
||||
@ -80,7 +85,7 @@ R_API bool r_th_setname(RThread *th, const char *name) {
|
||||
|
||||
R_API bool r_th_getname(RThread *th, char *name, size_t len) {
|
||||
#if defined(HAVE_PTHREAD_NP) && HAVE_PTHREAD_NP
|
||||
#if __linux__ || __NetBSD__
|
||||
#if __linux__ || __NetBSD__ || __APPLE__
|
||||
if (pthread_getname_np (th->tid, name, len) != 0) {
|
||||
eprintf ("Failed to get thread name\n");
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user