Class: Thread
- Inherits:
-
Object
- Object
- Thread
- Defined in:
- lib/celluloid/core_ext.rb
Overview
Monkeypatch Thread to allow lazy access to its Celluloid::Mailbox
Instance Attribute Summary collapse
-
#uuid_counter ⇒ Object
Returns the value of attribute uuid_counter.
-
#uuid_limit ⇒ Object
Returns the value of attribute uuid_limit.
Class Method Summary collapse
-
.mailbox ⇒ Object
Retrieve the mailbox for the current thread or lazily initialize it.
-
.receive(timeout = nil, &block) ⇒ Object
Receive a message either as an actor or through the local mailbox.
Instance Attribute Details
#uuid_counter ⇒ Object
Returns the value of attribute uuid_counter.
5 6 7 |
# File 'lib/celluloid/core_ext.rb', line 5 def uuid_counter @uuid_counter end |
#uuid_limit ⇒ Object
Returns the value of attribute uuid_limit.
5 6 7 |
# File 'lib/celluloid/core_ext.rb', line 5 def uuid_limit @uuid_limit end |
Class Method Details
.mailbox ⇒ Object
Retrieve the mailbox for the current thread or lazily initialize it
8 9 10 |
# File 'lib/celluloid/core_ext.rb', line 8 def self.mailbox current[:mailbox] ||= Celluloid::Mailbox.new end |
.receive(timeout = nil, &block) ⇒ Object
Receive a message either as an actor or through the local mailbox
13 14 15 16 17 18 19 |
# File 'lib/celluloid/core_ext.rb', line 13 def self.receive(timeout = nil, &block) if Celluloid.actor? Celluloid.receive(timeout, &block) else mailbox.receive(timeout, &block) end end |