aboutsummaryrefslogtreecommitdiffstats
path: root/ractor.h
Commit message (Collapse)AuthorAgeFilesLines
* refactoring rb_ractor_confirm_belonging()Koichi Sasada2020-10-211-3/+8
| | | | | | rb_ractor_belonging() returns 0 only if it has sharable flag. rb_ractor_confirm_belonging() checks rb_ractor_shareable_p() if the belonging ractor id is different from current ractor id.
* Ractor-safe rb_objspace_reachable_objects_fromKoichi Sasada2020-10-211-1/+6
| | | | | | | | | | rb_objspace_reachable_objects_from(obj) is used to traverse all reachable objects from obj. This function modify objspace but it is not ractor-safe (thread-safe). This patch fix the problem. Strategy: (1) call GC mark process during_gc (2) call Ractor-local custom mark func when !during_gc
* Some global variables can be accessed from ractorsKoichi Sasada2020-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ```
* Use language TLS specifier if it is possible.Koichi Sasada2020-10-201-0/+8
| | | | | | | To access TLS, it is faster to use language TLS specifier instead of using pthread_get/setspecific functions. Original proposal is: Use native thread locals. #3665
* change rb_ractor_queue to ring buffertompng2020-10-121-0/+1
|
* Add Ractor#receive and Ractor.receive and use it in all placesBenoit Daloze2020-10-101-5/+5
| | | | * Keep Ractor#recv/Ractor.recv as an alias for now.
* Ractor#close_outgoping cancel Ractor.yieldKoichi Sasada2020-09-251-0/+1
| | | | | | Ractor#close_outgoing should cancel waiting Ractor.yield. However, yield a value by the Ractor's block should not cancel (to recognize terminating Ractor, introduce rb_ractor_t::yield_atexit flag).
* show object info to debug purpose.Koichi Sasada2020-09-181-2/+3
|
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-0/+269
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues.