Class: PushyClient::ZmqContext
- Inherits:
-
Object
- Object
- PushyClient::ZmqContext
- Defined in:
- lib/pushy_client/protocol_handler.rb
Overview
Wrap the context with a lock. ZMQ gets grouchy if multiple threads access the context. Wrap it with a lock to block this. This mostly applies to the test system, where we run multiple clients in the same process
Constant Summary collapse
- ZMQ_CONTEXT =
ZMQ::Context.new(1)
- @@lock =
Mutex.new
Class Method Summary collapse
Class Method Details
.socket(arg) ⇒ Object
41 42 43 44 45 |
# File 'lib/pushy_client/protocol_handler.rb', line 41 def self.socket(arg) @@lock.synchronize do ZMQ_CONTEXT.socket(arg) end end |