summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-12-04 16:54:11 -0500
committerPeter Zhu <[email protected]>2024-12-05 16:21:37 -0500
commiteedb30d3855d31e15e6db48faea25af4afb63b6d (patch)
treed2fc817fccc72c16b7e8a98f29b30fed9feaef8f /signal.c
parentd4fb966186837795e1fd4f2cfa21af9bd962e01d (diff)
Use rb_gc_enable/rb_gc_disable_no_rest instead of ruby_disable_gc
We should use the rb_gc_enable/rb_gc_disable_no_rest APIs instead of directly setting the ruby_disable_gc variable.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12264
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/signal.c b/signal.c
index 2f7796c127..6c2a757a98 100644
--- a/signal.c
+++ b/signal.c
@@ -751,7 +751,10 @@ rb_get_next_signal(void)
#if defined SIGSEGV || defined SIGBUS || defined SIGILL || defined SIGFPE
static const char *received_signal;
-# define clear_received_signal() (void)(ruby_disable_gc = 0, received_signal = 0)
+# define clear_received_signal() do { \
+ if (GET_VM() != NULL) rb_gc_enable(); \
+ received_signal = 0; \
+} while (0)
#else
# define clear_received_signal() ((void)0)
#endif
@@ -1001,7 +1004,9 @@ check_reserved_signal_(const char *name, size_t name_len, int signo)
ruby_abort();
}
- ruby_disable_gc = 1;
+ if (GET_VM() != NULL) {
+ rb_gc_disable_no_rest();
+ }
}
#endif