diff options
author | MSP-Greg <[email protected]> | 2020-10-11 09:03:02 -0500 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-10-12 13:56:11 +0900 |
commit | c6652f223c6103a4d4d909d6b770cdfc5d140124 (patch) | |
tree | 4b8f463cad21e6e4e5a27c769a96d5c7ffd1e5b6 /ractor.rb | |
parent | eb21e8add346854aa93299bf767f119439f74f7a (diff) |
ractor.rb - indent comment code [ci skip]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3648
Diffstat (limited to 'ractor.rb')
-rw-r--r-- | ractor.rb | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -14,18 +14,18 @@ class Ractor # The result of the block is sent via the outgoing channel # and other # - # r = Ractor.new do - # Ractor.receive # receive via r's mailbox => 1 - # Ractor.receive # receive via r's mailbox => 2 - # Ractor.yield 3 # yield a message (3) and wait for taking by another ractor. - # 'ok' # the return value will be yielded. - # # and r's incoming/outgoing ports are closed automatically. - # end - # r.send 1 # send a message (1) into r's mailbox. - # r << 2 # << is an alias of `send`. - # p r.take # take a message from r's outgoing port => 3 - # p r.take # => 'ok' - # p r.take # raise Ractor::ClosedError + # r = Ractor.new do + # Ractor.receive # receive via r's mailbox => 1 + # Ractor.receive # receive via r's mailbox => 2 + # Ractor.yield 3 # yield a message (3) and wait for taking by another ractor. + # 'ok' # the return value will be yielded. + # # and r's incoming/outgoing ports are closed automatically. + # end + # r.send 1 # send a message (1) into r's mailbox. + # r << 2 # << is an alias of `send`. + # p r.take # take a message from r's outgoing port => 3 + # p r.take # => 'ok' + # p r.take # raise Ractor::ClosedError # # other options: # name: Ractor's name @@ -53,22 +53,22 @@ class Ractor # Multiplex multiple Ractor communications. # - # r, obj = Ractor.select(r1, r2) - # #=> wait for taking from r1 or r2 - # # returned obj is a taken object from Ractor r + # r, obj = Ractor.select(r1, r2) + # #=> wait for taking from r1 or r2 + # # returned obj is a taken object from Ractor r # - # r, obj = Ractor.select(r1, r2, Ractor.current) - # #=> wait for taking from r1 or r2 - # # or receive from incoming queue - # # If receive is succeed, then obj is received value - # # and r is :receive (Ractor.current) + # r, obj = Ractor.select(r1, r2, Ractor.current) + # #=> wait for taking from r1 or r2 + # # or receive from incoming queue + # # If receive is succeed, then obj is received value + # # and r is :receive (Ractor.current) # - # r, obj = Ractor.select(r1, r2, Ractor.current, yield_value: obj) - # #=> wait for taking from r1 or r2 - # # or receive from incoming queue - # # or yield (Ractor.yield) obj - # # If yield is succeed, then obj is nil - # # and r is :yield + # r, obj = Ractor.select(r1, r2, Ractor.current, yield_value: obj) + # #=> wait for taking from r1 or r2 + # # or receive from incoming queue + # # or yield (Ractor.yield) obj + # # If yield is succeed, then obj is nil + # # and r is :yield # def self.select(*ractors, yield_value: yield_unspecified = true, move: false) __builtin_cstmt! %q{ |