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
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
..
backward include/ruby/backward/2/rmodule.h: deprecate 2020-08-27 16:42:06 +09:00
internal Ractor.make_shareable(obj) 2020-10-21 07:59:24 +09:00
assert.h sync NDEBUG, RUBY_DEBUG, and RUBY_NDEBUG (#3327) 2020-08-07 14:01:13 +09:00
backward.h RUBY_SHOW_COPYRIGHT_TO_DIE: flip the default 2020-08-27 15:04:00 +09:00
debug.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
defines.h sed -i '\,2/extern.h,d' 2020-08-27 14:07:49 +09:00
encoding.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
intern.h drop varargs.h support 2020-05-11 14:56:51 +09:00
io.h Rework console to use rb_io_wait. 2020-09-14 16:44:09 +12:00
memory_view.h include/ruby/memory_view.h: annotate functions 2020-10-06 14:20:10 +09:00
missing.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
onigmo.h Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most pattern matches are less than or equal to 4 results 2019-05-07 21:58:55 +09:00
oniguruma.h
random.h RB_RANDOM_DATA_INIT_PARENT: convert into an inline function 2020-10-06 14:20:10 +09:00
re.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
regex.h add #include guard hack 2020-04-13 16:06:00 +09:00
ruby.h include/ruby/backward/2/rmodule.h: deprecate 2020-08-27 16:42:06 +09:00
st.h Fix typos (#2958) 2020-03-11 00:43:12 -07:00
subst.h add #include guard hack 2020-04-13 16:06:00 +09:00
thread.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
thread_native.h add #include guard hack 2020-04-13 16:06:00 +09:00
util.h include/ruby/util.h: delete unused codes 2020-07-23 14:30:12 +09:00
version.h Version number bumped to 3.0.0 from 2.8.0 (tentative). 2020-08-31 16:38:13 +09:00
vm.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
win32.h Fix errno at seeking socket/pipe on Windows 2019-07-25 06:39:40 +09:00