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-2016 all contributors <[email protected]> License: GPL-3.0+ (www.gnu.org/licenses/gpl-3.0.txt) frozen_string_literal: true

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.



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

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:



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

def to_io
  @to_io
end

Class Method Details

.newObject



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

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

Instance Method Details

#closeObject



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

def close
  @to_io.close
  @wr.close
end

#kgio_wait_readable(*args) ⇒ Object



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

def kgio_wait_readable(*args)
  @to_io.kgio_wait_readable(*args)
end

#sev_signalObject



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

def sev_signal
  incr(1, true) # eventfd_write
end

#yahns_stepObject



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

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