From 5f43f4a284ec1ab2b22267710e0aa3c462412443 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <vital.had@gmail.com>
Date: Sun, 10 Nov 2024 21:33:55 +0800
Subject: [PATCH] runtime/thread.c: fix including pthread on macOS

---
 src/runtime/thread.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/runtime/thread.c b/src/runtime/thread.c
index 544cae574d..479235ca6d 100644
--- src/runtime/thread.c
+++ src/runtime/thread.c
@@ -12,6 +12,9 @@
 #ifdef __linux__
 #define _GNU_SOURCE // for pthread_setname_np()
 #endif
+#ifdef __APPLE__
+#define _DARWIN_C_SOURCE // for pthread_setname_np()
+#endif
 #include "genesis/sbcl.h"
 
 #include <stdlib.h>

--- src/runtime/darwin-os.c
+++ src/runtime/darwin-os.c
@@ -14,6 +14,10 @@
  * files for more information.
  */
 
+#ifdef __APPLE__
+#define _DARWIN_C_SOURCE // pthread_mach_thread_np()
+#endif
+
 #include "thread.h"
 #include "genesis/sbcl.h"
 #include "globals.h"
