[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] pipe: use memoized IO#nonblock? in blocking case
From: |
Eric Wong |
Subject: |
[PATCH 3/3] pipe: use memoized IO#nonblock? in blocking case |
Date: |
Sun, 6 Oct 2013 11:34:53 +0000 |
We never change the I/O directly, so avoid the expensive syscall and
only use a slightly-expensive Ruby method call instead (the Ruby
method call is fixed cost in either case).
---
lib/dtas/pipe.rb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/dtas/pipe.rb b/lib/dtas/pipe.rb
index 41783d3..a4ce57c 100644
--- a/lib/dtas/pipe.rb
+++ b/lib/dtas/pipe.rb
@@ -22,6 +22,11 @@ class DTAS::Pipe < IO # :nodoc:
def pipe_size=(_)
end
end
+
+ # avoid syscall, we never change IO#nonblock= directly
+ def nonblock?
+ false
+ end
end
# for non-blocking sinks, this avoids extra fcntl(..., F_GETFL) syscalls
--
1.8.4