class method
Ractor.count
() -> ::Integer
count
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ractor.rb, line 258
def self.count
__builtin_cexpr! %q{
ULONG2NUM(GET_VM()->ractor.cnt);
}
end
Returns the number of ractors currently running or blocking (waiting).
Example
Ractor.count #=> 1 r = Ractor.new(name: 'example') { Ractor.receive } Ractor.count #=> 2 (main + example ractor) r << 42 # r's Ractor.receive will resume r.join # wait for r's termination Ractor.count #=> 1