aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2023-03-01 15:07:00 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-04-07 14:54:38 +0200
commit58d24a4cb630a6162d6f7d2a85e41949fdf2ad36 (patch)
treef03a34d6f2c5f652f83a8a4153d3e80ca98f07c3 /src/libutil
parent00bc34430b9e8e687cd3f1681e9f7b5baa7c717e (diff)
Always disable GC in a coroutine unless the patch is applied
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/serialise.cc9
-rw-r--r--src/libutil/serialise.hh4
2 files changed, 6 insertions, 7 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc
index 0bdeec0cd..6e53239f5 100644
--- a/src/libutil/serialise.cc
+++ b/src/libutil/serialise.cc
@@ -186,18 +186,17 @@ static DefaultStackAllocator defaultAllocatorSingleton;
StackAllocator *StackAllocator::defaultAllocator = &defaultAllocatorSingleton;
-std::shared_ptr<void> (*create_disable_gc)() = []() -> std::shared_ptr<void> {
+std::shared_ptr<void> (*create_coro_gc_hook)() = []() -> std::shared_ptr<void> {
return {};
};
/* This class is used for entry and exit hooks on coroutines */
class CoroutineContext {
-#if __APPLE__
- /* Disable GC when entering the coroutine on macOS, since it doesn't find the main thread stack in this case.
+ /* Disable GC when entering the coroutine without the boehm patch,
+ * since it doesn't find the main thread stack in this case.
* std::shared_ptr<void> performs type-erasure, so it will call the right
* deleter. */
- const std::shared_ptr<void> disable_gc = create_disable_gc();
-#endif
+ const std::shared_ptr<void> coro_gc_hook = create_coro_gc_hook();
public:
CoroutineContext() {};
~CoroutineContext() {};
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index b895db779..ba6dbf619 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -551,10 +551,10 @@ struct StackAllocator {
static StackAllocator *defaultAllocator;
};
-/* Disabling GC when entering a coroutine (on macos).
+/* Disabling GC when entering a coroutine (without the boehm patch).
mutable to avoid boehm gc dependency in libutil.
*/
-extern std::shared_ptr<void> (*create_disable_gc)();
+extern std::shared_ptr<void> (*create_coro_gc_hook)();
}