lib/celluloid/group.rb in celluloid-0.18.0.pre vs lib/celluloid/group.rb in celluloid-0.18.0.pre2
- old
+ new
@@ -1,35 +1,35 @@
module Celluloid
class Group
attr_accessor :group
def initialize
- @pid = $$
+ @pid = $PROCESS_ID
@mutex = Mutex.new
@group = []
@running = true
end
def assert_active
- fail Celluloid::NotActive unless active?
+ raise 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
+ raise Celluloid::StillActive
end
end
def each
to_a.each { |thread| yield thread }
end
def forked?
- @pid != $$
+ @pid != $PROCESS_ID
end
def to_a
return [] if forked?
res = nil
@@ -38,11 +38,15 @@
end
def purge(thread)
@mutex.synchronize do
@group.delete(thread)
- thread.kill rescue nil
+ begin
+ thread.kill
+ rescue
+ nil
+ end
end
end
def each_actor(&block)
to_a.lazy.select { |t| t[:celluloid_role] == :actor }.each(&block)
@@ -51,17 +55,17 @@
def active?
@running
end
def get
- fail NotImplementedError
+ raise NotImplementedError
end
def create
- fail NotImplementedError
+ raise NotImplementedError
end
def shutdown
- fail NotImplementedError
+ raise NotImplementedError
end
end
end