Skip to content
class method

Ractor.count

() -> ::Integer
count

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
See also .[]= .current .[] .main also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0