lib/0mq/poll_interruptible.rb
# Interrupt the running poll loop, but do not clean up.
# This should be run anytime to let the poller re-evaluate state, etc..
# This should only be accessed from a thread other than the poll thread,
#   and only if the poll thread is running
# If a block is given, it will be executed in the poll thread just
#   prior to the execution of the user block passed to {#run}.
# If the blocking: false option is is given, the call will not wait for
#   the interruption to be processed.
Interrupt the running poll loop, but do not clean up.
This should be run anytime to let the poller re-evaluate state, etc
This should only be accessed from a thread other than the poll thread,
and only if the poll thread is running
If a block is given, it will be executed in the poll thread just
prior to the execution of the user block passed to {#run}.
If the blocking: false option is is given, the call will not wait for
the interruption to be processed.
Interrupt the running poll loop but do not clean up . This should be run anytime to let the poller re - evaluate state etc This should only be accessed from a thread other than the poll thread and only if the poll thread is running If a block is given it will be executed in the poll thread just prior to the execution of the user block passed to { #run } . If the blocking : false option is is given the call will not wait for the interruption to be processed .
def interrupt(opts={}, &block)
      blocking = opts.fetch :blocking, true
      block ||= Proc.new { true }
      key = block.object_id.to_s 36
      if blocking
        @int_lock_req.synchronize {
          @interruptions.push block     
          @int_sock_req.send_string key 
          @int_sock_req.recv_array      
        }
        return @outerruptions.pop       
      else
        @int_lock_push.synchronize {
          @interruptions.push block      
          @int_sock_push.send_string key 
        }
        return nil
      end
    end
def interrupt ( opts = { } , & block ) blocking = opts . fetch :blocking , true block ||= Proc . new { true } key = block . object_id . to_s 36 if blocking @int_lock_req . synchronize { @interruptions . push block @int_sock_req . send_string key @int_sock_req . recv_array } return @outerruptions . pop else @int_lock_push . synchronize { @interruptions . push block @int_sock_push . send_string key } return nil end end
Interrupt the running poll loop, but do not clean up.
Interrupt the running poll loop but do not clean up .
# block = block.dup # Store the block to be called # Signal an interruption to #run # Wait until it has been handled by #run # Return the stored result of the block # Store the block to be called # Signal an interruption to #run
opts
<not_specific>
block
<not_specific>