Sha256: f865c7ff98db8189d19d3c256a706082c7ed0cd57fd9c3543000c2ae1c236f01
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module Celluloid class Group attr_accessor :group def initialize @pid = $$ @mutex = Mutex.new @group = [] @running = true end def assert_active fail Celluloid::NotActive unless active? end def assert_inactive return unless active? if RUBY_PLATFORM == "java" Celluloid.logger.warn "Group is still active" else fail Celluloid::StillActive end end def each to_a.each { |thread| yield thread } end def forked? @pid != $$ end def to_a return [] if forked? res = nil @mutex.synchronize { res = @group.dup } res end def purge(thread) @mutex.synchronize do @group.delete(thread) thread.kill rescue nil end end def each_actor(&block) to_a.lazy.select { |t| t[:celluloid_role] == :actor }.each(&block) end def active? @running end def get fail NotImplementedError end def create fail NotImplementedError end def shutdown fail NotImplementedError end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.17.4 | lib/celluloid/group.rb |
celluloid-0.18.0.pre | lib/celluloid/group.rb |