Class: Yahns::QueueQuitter

Inherits:
Sigevent
  • Object
show all
Defined in:
lib/yahns/queue_quitter.rb,
lib/yahns/queue_quitter_pipe.rb

Overview

Copyright © 2013, Eric Wong <[email protected]> and all contributors License: GPLv3 or later (www.gnu.org/licenses/gpl-3.0.txt)

POSIX pipe version, see queue_quitter.rb for the (preferred) eventfd one

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Sigevent

#kgio_wait_readable, new, #sev_signal

Constructor Details

#initializeQueueQuitter

Returns a new instance of QueueQuitter.



7
8
9
10
11
# File 'lib/yahns/queue_quitter_pipe.rb', line 7

def initialize
  reader, @to_io = IO.pipe
  @to_io.close_on_exec = true
  reader.close
end

Instance Attribute Details

#to_ioObject (readonly)

:nodoc:



6
7
8
# File 'lib/yahns/queue_quitter_pipe.rb', line 6

def to_io
  @to_io
end

Instance Method Details

#closeObject



21
22
23
# File 'lib/yahns/queue_quitter_pipe.rb', line 21

def close
  @to_io.close
end

#filenoObject



17
18
19
# File 'lib/yahns/queue_quitter_pipe.rb', line 17

def fileno
  @to_io.fileno
end

#yahns_stepObject



10
11
12
# File 'lib/yahns/queue_quitter.rb', line 10

def yahns_step
  Thread.current.exit
end