aboutsummaryrefslogtreecommitdiffstats
path: root/ractor.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-10-31 00:40:04 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-31 01:48:00 +0900
commitfd089276999393a6f6bb2a0b614ac76ca6151ab2 (patch)
tree711b652e7051adc7ab23e150ce65cb0d8f4e2439 /ractor.h
parent66bf743b9309b479b6d5389e315ca54ea73aafae (diff)
downloadruby-fd089276999393a6f6bb2a0b614ac76ca6151ab2.tar.gz
Ractor's "will" doesn't need copying.
`r = Ractor.new{ expr }` generates the block return value from `expr` and we can get this value by `r.take`. Ractor.yield and Ractor#take passing values by copying on default. However, the block return value (we named it "will" in the code) is not referred from the Ractor because the Ractor is already dead. So we can pass the reference of "will" to another ractor without copying. We can apply same story for the propagated exception.
Diffstat (limited to 'ractor.h')
-rw-r--r--ractor.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/ractor.h b/ractor.h
index e3adeb8d07..6e2f09f9b3 100644
--- a/ractor.h
+++ b/ractor.h
@@ -10,15 +10,15 @@
enum rb_ractor_basket_type {
basket_type_none,
- basket_type_shareable,
- basket_type_copy_marshal,
- basket_type_copy_custom,
+ basket_type_ref,
+ basket_type_copy,
basket_type_move,
- basket_type_exception,
+ basket_type_will,
};
struct rb_ractor_basket {
enum rb_ractor_basket_type type;
+ bool exception;
VALUE v;
VALUE sender;
};