aboutsummaryrefslogtreecommitdiff
path: root/src/threading.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-05-15 10:33:52 +0100
committerGitHub <noreply@github.com>2024-05-15 10:33:52 +0100
commitf9fd8f0c25bb0b239e5421c39217d2f8c449911f (patch)
tree9ba2c4a3db02996a129ceb5e640ee268376d56d2 /src/threading.cpp
parent59c33dd9fce58f2fdf396a622c446f3912e88a95 (diff)
parent6298d4a36c484e0a78dd61a9b1bf760dbae1969a (diff)
Merge pull request #3439 from andreas-jonsson/netbsd
NetBSD support
Diffstat (limited to 'src/threading.cpp')
-rw-r--r--src/threading.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/threading.cpp b/src/threading.cpp
index f2e0789f8..48c58e8f4 100644
--- a/src/threading.cpp
+++ b/src/threading.cpp
@@ -628,15 +628,23 @@ gb_internal void thread_set_name(Thread *t, char const *name) {
pthread_setname_np(name);
#elif defined(GB_SYSTEM_FREEBSD) || defined(GB_SYSTEM_OPENBSD)
pthread_set_name_np(t->posix_handle, name);
+#elif defined(GB_SYSTEM_NETBSD)
+ pthread_setname_np(t->posix_handle, "%s", (void*)name);
#else
// TODO(bill): Test if this works
pthread_setname_np(t->posix_handle, name);
#endif
}
-#if defined(GB_SYSTEM_LINUX)
-#include <linux/futex.h>
+#if defined(GB_SYSTEM_LINUX) || defined(GB_SYSTEM_NETBSD)
+
#include <sys/syscall.h>
+#ifdef GB_SYSTEM_LINUX
+ #include <linux/futex.h>
+#else
+ #include <sys/futex.h>
+ #define SYS_futex SYS___futex
+#endif
gb_internal void futex_signal(Futex *addr) {
int ret = syscall(SYS_futex, addr, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1, NULL, NULL, 0);