mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ractor.rb - indent comment code [ci skip]
This commit is contained in:
parent
eb21e8add3
commit
c6652f223c
Notes:
git
2020-10-12 13:56:34 +09:00
1 changed files with 26 additions and 26 deletions
52
ractor.rb
52
ractor.rb
|
@ -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{
|
||||
|
|
Loading…
Add table
Reference in a new issue