summaryrefslogtreecommitdiff
path: root/ractor.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-10-21 13:53:46 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-21 16:15:22 +0900
commitb59077eecf912a16efefc0256f6e94a000ce3888 (patch)
treea1e4c2c6326c7576bab66f724075905c6151ffa5 /ractor.h
parent4640c4ea8a693a9a8468251135afff837904a3a5 (diff)
Ractor-safe rb_objspace_reachable_objects_from
rb_objspace_reachable_objects_from(obj) is used to traverse all reachable objects from obj. This function modify objspace but it is not ractor-safe (thread-safe). This patch fix the problem. Strategy: (1) call GC mark process during_gc (2) call Ractor-local custom mark func when !during_gc
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3680
Diffstat (limited to 'ractor.h')
-rw-r--r--ractor.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/ractor.h b/ractor.h
index 1afd91b77c..50c16ff451 100644
--- a/ractor.h
+++ b/ractor.h
@@ -121,12 +121,17 @@ struct rb_ractor_struct {
struct list_node vmlr_node;
-
VALUE r_stdin;
VALUE r_stdout;
VALUE r_stderr;
VALUE verbose;
VALUE debug;
+
+ // gc.c rb_objspace_reachable_objects_from
+ struct gc_mark_func_data_struct {
+ void *data;
+ void (*mark_func)(VALUE v, void *data);
+ } *mfd;
}; // rb_ractor_t is defined in vm_core.h
rb_ractor_t *rb_ractor_main_alloc(void);