yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob e18e2499c08fb966e56d36647d15c2d20f1c0930 509 bytes (raw)
$ git show the_metal:lib/yahns/queue_quitter_pipe.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
#
# POSIX pipe version, see queue_quitter.rb for the (preferred) eventfd one
class Yahns::QueueQuitter # :nodoc:
  attr_reader :to_io
  def initialize
    @reader, @to_io = IO.pipe
    @to_io.close_on_exec = true
  end

  def yahns_step
    Thread.current.exit
  end

  def fileno
    @to_io.fileno
  end

  def close
    @reader.close
    @to_io.close
  end
end

git clone git://yhbt.net/yahns.git
git clone https://yhbt.net/yahns.git