unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] explain 11 byte magic number for self-pipe
@ 2015-02-18  9:36 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-02-18  9:36 UTC (permalink / raw)
  To: unicorn-public; +Cc: Steven Stewart-Gallus, Jesse Storimer

Oops, this should've been explained long ago but apparently not.

In response to a comment on

> Does anybody know why both unicorn and foreman read 11 bytes from
> self-pipe?

Unfortunately I couldn't find a way to comment on the site on a
JavaScript-free browser nor does it seem possible without

Again, anybody can send plain-text mail to:

No registration, no real name policy, no terms-of-service, just
plain-text.  Feel free to use Tor, mixmaster or any anonymity
service, too.
 lib/unicorn/http_server.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 015bd94..683eb82 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -370,6 +370,10 @@ class Unicorn::HttpServer
   # wait for a signal hander to wake us up and then consume the pipe
   def master_sleep(sec)
     IO.select([ @self_pipe[0] ], nil, nil, sec) or return
+    # 11 bytes is the maximum string length which can be embedded within
+    # the Ruby itself and not require a separate malloc (on 32-bit MRI 1.9+).
+    # Most reads are only one byte here and uncommon, so it's not worth a
+    # persistent buffer, either:

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

only message in thread, other threads:[~2015-02-18  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18  9:36 [PATCH] explain 11 byte magic number for self-pipe Eric Wong

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


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).