⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Ractor
/
View File Name :
select-c.ri
U:RDoc::AnyMethod[iI"select:ETI"Ractor::select;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"dWaits for the first ractor to have something in its outgoing port, reads from this ractor, and ;TI"1returns that ractor and the object received.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-r1 = Ractor.new {Ractor.yield 'from 1'} ;TI"-r2 = Ractor.new {Ractor.yield 'from 2'} ;TI" ;TI"$r, obj = Ractor.select(r1, r2) ;TI" ;TI"6puts "received #{obj.inspect} from #{r.inspect}" ;TI"E# Prints: received "from 1" from #
;T:@format0o; ; [I"cIf one of the given ractors is the current ractor, and it would be selected, +r+ will contain ;TI"4+:receive+ symbol instead of the ractor object.;T@o;; [I"/r1 = Ractor.new(Ractor.current) do |main| ;TI" main.send 'to main' ;TI" Ractor.yield 'from 1' ;TI" end ;TI"r2 = Ractor.new do ;TI" Ractor.yield 'from 2' ;TI" end ;TI" ;TI"4r, obj = Ractor.select(r1, r2, Ractor.current) ;TI"6puts "received #{obj.inspect} from #{r.inspect}" ;TI"0# Prints: received "to main" from :receive ;T; 0o; ; [I"aIf +yield_value+ is provided, that value may be yielded if another Ractor is calling #take. ;TI"EIn this case, the pair
[:yield, nil]
would be returned:;T@o;; [ I"/r1 = Ractor.new(Ractor.current) do |main| ;TI"/ puts "Received from main: #{main.take}" ;TI" end ;TI" ;TI"puts "Trying to select" ;TI"Br, obj = Ractor.select(r1, Ractor.current, yield_value: 123) ;TI" wait ;TI"6puts "Received #{obj.inspect} from #{r.inspect}" ;T; 0o; ; [I"This will print:;T@o;; [I"Trying to select ;TI"Received from main: 123 ;TI"Received nil from :yield ;T; 0o; ; [I"[+move+ boolean flag defines whether yielded value should be copied (default) or moved.;T: @fileI"ractor.rb;T:0@omit_headings_from_table_of_contents_below0I"URactor.select(*ractors, [yield_value:, move: false]) -> [ractor or symbol, obj] ;T0[ I"C(*ractors, yield_value: yield_unspecified = true, move: false);T@CFI"Ractor;TcRDoc::NormalClass00