aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
commitf9add8b6bea4df3cdbd56a21f17e4cab1a854e4e (patch)
tree8e5306104d81c67b771181337bba02cd9ec39453 /src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
parent81a1a58d66c598ea35c42453d0ba4c6341a940fc (diff)
parent9b5e66453b0879ed77b71dcdbe50e4efa184261e (diff)
downloadbun-sdl.tar.gz
bun-sdl.tar.zst
bun-sdl.zip
Merge branch 'main' into sdlsdl
Diffstat (limited to '')
-rw-r--r--src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
index f607d586a..0e3fcf47d 100644
--- a/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
+++ b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
@@ -1,12 +1,30 @@
#include "root.h"
#include "JavaScriptCore/VM.h"
+// On Linux, signals are used to suspend/resume threads in JavaScriptCore
+// When `.acquireAccess` is called, the signal might be raised.
+// This causes issues with LLDB which might catch the signal.
+// So we want to avoid that, we really only want this code to be executed when the debugger is attached
+// But it's pretty hard to tell if LLDB is attached or not, so we just disable this code on Linux when in debug mode
+#ifndef ACQUIRE_RELEASE_HEAP_ACCESS
+#if OS(DARWIN)
+#define ACQUIRE_RELEASE_HEAP_ACCESS 1
+#else
+#ifndef BUN_DEBUG
+#define ACQUIRE_RELEASE_HEAP_ACCESS 1
+#endif
+#endif
+#endif
+
extern "C" void bun_on_tick_before(JSC::VM* vm)
{
- // Let the GC do some work while we are idle
- vm->heap.releaseAccess();
+#if ACQUIRE_RELEASE_HEAP_ACCESS
+ // vm->heap.releaseAccess();
+#endif
}
extern "C" void bun_on_tick_after(JSC::VM* vm)
{
- vm->heap.acquireAccess();
+#if ACQUIRE_RELEASE_HEAP_ACCESS
+ // vm->heap.acquireAccess();
+#endif
} \ No newline at end of file