summaryrefslogtreecommitdiff
path: root/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch')
-rw-r--r--Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch b/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch
new file mode 100644
index 0000000000..5e83d7d941
--- /dev/null
+++ b/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch
@@ -0,0 +1,52 @@
+From 825f33e226dbe842fb6588ba73c31b9fbb079f11 Mon Sep 17 00:00:00 2001
+From: Ali Mohammad Pur <ali.mpfard@gmail.com>
+Date: Fri, 25 Feb 2022 04:53:53 +0330
+Subject: [PATCH 6/6] Make the collector build with threads
+
+In an extremely limited way for now:
+- No extra threads
+ More threads always lead to exactly one borked thread that's stuck
+ in no man's land, doing who-knows-what, and definitely not
+ responding to signals.
+ However, the APIs are there and they work, so they *can* be used to
+ make threads.
+- No fork handling
+ Seems borked for unknown reasons.
+---
+ CMakeLists.txt | 6 +++++-
+ tests/test.c | 2 +-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e9c52f1..7c9daad 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -56,7 +56,11 @@ IF(enable_threads)
+ MESSAGE("Libs: ${LIBS}" )
+ ENDIF(enable_threads)
+
+-OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
++IF(DEBUG_THREADS)
++ ADD_DEFINITIONS("-DDEBUG_THREADS")
++ENDIF()
++
++OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" OFF)
+
+ OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON)
+
+diff --git a/tests/test.c b/tests/test.c
+index 8e2e3a6..f38fb22 100644
+--- a/tests/test.c
++++ b/tests/test.c
+@@ -40,7 +40,7 @@
+ #include "gc.h"
+
+ #ifndef NTHREADS /* Number of additional threads to fork. */
+-# define NTHREADS 5 /* excludes main thread, which also runs a test. */
++# define NTHREADS 0 /* excludes main thread, which also runs a test. */
+ /* Not respected by PCR test. */
+ #endif
+
+--
+2.35.1
+