1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby/internal
Koichi Sasada 2f50936cb9 Ractor.make_shareable(obj)
Introduce new method Ractor.make_shareable(obj) which tries to make
obj shareable object. Protocol is here.

(1) If obj is shareable, it is shareable.
(2) If obj is not a shareable object and if obj can be shareable
    object if it is frozen, then freeze obj. If obj has reachable
    objects (rs), do rs.each{|o| Ractor.make_shareable(o)}
    recursively (recursion is not Ruby-level, but C-level).
(3) Otherwise, raise Ractor::Error. Now T_DATA is not a shareable
    object even if the object is frozen.

If the method finished without error, given obj is marked as
a sharable object.

To allow makng a shareable frozen T_DATA object, then set
`RUBY_TYPED_FROZEN_SHAREABLE` as type->flags. On default,
this flag is not set. It means user defined T_DATA objects are
not allowed to become shareable objects when it is frozen.

You can make any object  shareable by setting FL_SHAREABLE flag,
so if you know that the T_DATA object is shareable (== thread-safe),
set this flag, at creation time for example. `Ractor` object is one
example, which is not a frozen, but a shareable object.
2020-10-21 07:59:24 +09:00
..
arithmetic Add RB_ prefix for size_t to number conversion. 2020-09-06 15:37:54 +12:00
attr sync NDEBUG, RUBY_DEBUG, and RUBY_NDEBUG (#3327) 2020-08-07 14:01:13 +09:00
compiler_is
core Ractor.make_shareable(obj) 2020-10-21 07:59:24 +09:00
has RBIMPL_HAS_CPP_ATTRIBUTE: handle SunPro 2020-08-21 11:04:54 +09:00
intern Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241) 2020-10-21 02:40:18 +09:00
anyargs.h
arithmetic.h
assume.h Revert "RBIMPL_UNREACHABLE_RETURN: evaluate the argument" 2020-06-29 12:33:17 +09:00
cast.h
compiler_is.h
compiler_since.h
config.h Fix a typo [ci skip] 2020-08-29 12:31:05 +09:00
constant_p.h
core.h
ctype.h
dllexport.h
dosish.h
error.h Add rb_category_warn{,ing} for warning messages with categories 2020-09-28 08:38:06 -07:00
eval.h
event.h
fl_type.h should not check taint flag on rubyspec. 2020-09-25 12:52:53 +09:00
gc.h
glob.h
globals.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
interpreter.h
iterator.h
memory.h ALLOCA_N: do not use RUBY_ALIGNOF 2020-09-25 11:38:33 +09:00
method.h
module.h
newobj.h
rgengc.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
scan_args.h Added UNREACHABLE_RETURN 2020-05-21 13:31:36 +09:00
special_consts.h
static_assert.h
stdalign.h fix typo [ci skip] 2020-09-29 09:57:47 +09:00
stdbool.h
symbol.h
token_paste.h
value.h
value_type.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
variable.h
warning_push.h
xmalloc.h