End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Ractor.count
count
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/ractor.rb, line 291
def self.count
__builtin_cexpr! %q{
ULONG2NUM(GET_VM()->ractor.cnt);
}
end
Returns total count of Ractors currently running.
Example
Ractor.count #=> 1 r = Ractor.new(name: 'example') { Ractor.yield(1) } Ractor.count #=> 2 (main + example ractor) r.take # wait for Ractor.yield(1) r.take # wait till r will finish Ractor.count #=> 1