Class: Yahns::QueueQuitter

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

Overview

Copyright © 2013-2016 all contributors <[email protected]> License: GPL-3.0+ (www.gnu.org/licenses/gpl-3.0.txt) frozen_string_literal: true

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.



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

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

Instance Attribute Details

#to_ioObject (readonly)

:nodoc:



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

def to_io
  @to_io
end

Instance Method Details

#closeObject



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

def close
  @reader.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



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

def yahns_step
  Thread.current.exit
end