aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-17 14:10:25 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-17 14:10:25 -0700
commit7458b969c5d9971e89d187b687e1924e78da427e (patch)
treeee3dbf95c728cf407bf49a27826b541e9264a8bd /src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
parentd4a2c29131ec154f5e4db897d4deedab2002cbc4 (diff)
parente91436e5248d947b50f90b4a7402690be8a41f39 (diff)
downloadbun-7458b969c5d9971e89d187b687e1924e78da427e.tar.gz
bun-7458b969c5d9971e89d187b687e1924e78da427e.tar.zst
bun-7458b969c5d9971e89d187b687e1924e78da427e.zip
Merge branch 'main' into postinstall_3
Diffstat (limited to 'src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp')
-rw-r--r--src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
new file mode 100644
index 000000000..0e3fcf47d
--- /dev/null
+++ b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
@@ -0,0 +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)
+{
+#if ACQUIRE_RELEASE_HEAP_ACCESS
+ // vm->heap.releaseAccess();
+#endif
+}
+extern "C" void bun_on_tick_after(JSC::VM* vm)
+{
+#if ACQUIRE_RELEASE_HEAP_ACCESS
+ // vm->heap.acquireAccess();
+#endif
+} \ No newline at end of file