about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-12-13 10:08:30 +0000
committerEric Wong <e@80x24.org>2018-12-13 10:08:30 +0000
commitcbc0c9d4da3bc1a568b253b9ba4d20da6f7d86a6 (patch)
treea61cd185f9725902788a7a44999708b172c87026
parent2ee9353fba7be5443db2ccdc3541586932ccf1f1 (diff)
downloadyahns-cbc0c9d4da3bc1a568b253b9ba4d20da6f7d86a6.tar.gz
We use eventfd whereever possible, but workers still require
a pipe to the parent for death detection.
-rw-r--r--lib/yahns/worker.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/yahns/worker.rb b/lib/yahns/worker.rb
index 9192803..1b65e3d 100644
--- a/lib/yahns/worker.rb
+++ b/lib/yahns/worker.rb
@@ -9,6 +9,14 @@ class Yahns::Worker # :nodoc:
   def initialize(nr)
     @nr = nr
     @to_io, @wr = Kgio::Pipe.new
+
+    # Seems it's only alpha with a != 4K page size on Linux
+    begin
+      # F_SETPIPE_SZ = 1031, PAGE_SIZE = 4096
+      @to_io.fcntl(1031, 4096)
+    rescue Errno::EINVAL
+      # old kernel
+    end if RUBY_PLATFORM =~ /\blinux\b/ && RUBY_PLATFORM !~ /alpha/
   end
 
   def atfork_child