[DOC] Make "Appendix F. Ractor support" a numbered list
This commit is contained in:
parent
5aba5f0454
commit
9ff4e52d5d
@ -2210,7 +2210,7 @@ Ractor safety around C extensions has the following properties:
|
||||
|
||||
To make a "Ractor-safe" C extension, we need to check the following points:
|
||||
|
||||
(1) Do not share unshareable objects between ractors
|
||||
1. Do not share unshareable objects between ractors
|
||||
|
||||
For example, C's global variable can lead sharing an unshareable objects
|
||||
between ractors.
|
||||
@ -2228,7 +2228,7 @@ such as global st_table can share the objects, so please take care.
|
||||
Note that class and module objects are shareable objects, so you can
|
||||
keep the code "cFoo = rb_define_class(...)" with C's global variables.
|
||||
|
||||
(2) Check the thread-safety of the extension
|
||||
2. Check the thread-safety of the extension
|
||||
|
||||
An extension should be thread-safe. For example, the following code is
|
||||
not thread-safe:
|
||||
@ -2252,12 +2252,12 @@ consequence, it is easier to make code ractor-safe than to make code generally
|
||||
thread-safe. For example, we don't need to lock an array object to access the
|
||||
element of it.
|
||||
|
||||
(3) Check the thread-safety of any used library
|
||||
3. Check the thread-safety of any used library
|
||||
|
||||
If the extension relies on an external library, such as a function foo() from
|
||||
a library libfoo, the function libfoo foo() should be thread safe.
|
||||
|
||||
(4) Make an object shareable
|
||||
4. Make an object shareable
|
||||
|
||||
This is not required to make an extension Ractor-safe.
|
||||
|
||||
@ -2268,7 +2268,7 @@ RUBY_TYPED_FROZEN_SHAREABLE flag indicates that these objects can be
|
||||
shareable objects if the object is frozen. This means that if the object
|
||||
is frozen, the mutation of wrapped data is not allowed.
|
||||
|
||||
(5) Others
|
||||
5. Others
|
||||
|
||||
There are possibly other points or requirements which must be considered in the
|
||||
making of a Ractor-safe extension. This document will be extended as they are
|
||||
|
Loading…
x
Reference in New Issue
Block a user