Class: Yahns::Sigevent

Inherits:
SleepyPenguin::EventFD
  • Object
show all
Includes:
Kgio::DefaultWaiters
Defined in:
lib/yahns/sigevent_efd.rb,
lib/yahns/sigevent_pipe.rb

Overview

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

Direct Known Subclasses

QueueQuitter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSigevent

Returns a new instance of Sigevent.



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

def initialize
  @to_io, @wr = Kgio::Pipe.new
  @to_io.close_on_exec = @wr.close_on_exec = true
end

Instance Attribute Details

#to_ioObject (readonly)

:nodoc:



5
6
7
# File 'lib/yahns/sigevent_pipe.rb', line 5

def to_io
  @to_io
end

Class Method Details

.newObject



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

def self.new
  super(0, SleepyPenguin::EventFD::CLOEXEC)
end

Instance Method Details

#closeObject



26
27
28
29
# File 'lib/yahns/sigevent_pipe.rb', line 26

def close
  @to_io.close
  @wr.close
end

#kgio_wait_readableObject



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

def kgio_wait_readable
  @to_io.kgio_wait_readable
end

#sev_signalObject



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

def sev_signal
  incr(1) # eventfd_write
end

#yahns_stepObject



14
15
16
17
# File 'lib/yahns/sigevent_efd.rb', line 14

def yahns_step
  value(true) # eventfd_read, we ignore this data
  :wait_readable
end