yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] yahns/worker: shrink pipe under Linux
@ 2018-12-13 10:10 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2018-12-13 10:10 UTC (permalink / raw)
  To: yahns-public

We use eventfd whereever possible, but workers still require
a pipe to the parent for death detection.
---
 lib/yahns/worker.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-13 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 10:10 [PATCH] yahns/worker: shrink pipe under Linux Eric Wong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).