summaryrefslogtreecommitdiff
path: root/ractor.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-10-20 11:21:49 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-20 15:39:37 +0900
commit2bdbdc1580f52dc8d70a71b824238e0f20342dca (patch)
tree7801ce5dc8a9ea25187af4426d797d1d15565178 /ractor.rb
parent99310e3eb56fbc85bb45119285812eb959448d0c (diff)
add Ractor.shareable?(obj)
This method returns obj is shareable or not.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3672
Diffstat (limited to 'ractor.rb')
-rw-r--r--ractor.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/ractor.rb b/ractor.rb
index 78980b2685..c825fbe0da 100644
--- a/ractor.rb
+++ b/ractor.rb
@@ -166,4 +166,11 @@ class Ractor
close_incoming
close_outgoing
end
+
+ # utility method
+ def self.shareable? obj
+ __builtin_cexpr! %q{
+ rb_ractor_shareable_p(obj) ? Qtrue : Qfalse;
+ }
+ end
end