[ruby-cvs:73022] normal:r65922 (trunk): io + socket: make pipes and sockets nonblocking by default

normal at ruby-lang.org normal at ruby-lang.org
Thu Nov 22 17:46:52 JST 2018


normal	2018-11-22 17:46:51 +0900 (Thu, 22 Nov 2018)

  New Revision: 65922

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65922

  Log:
    io + socket: make pipes and sockets nonblocking by default
    
    All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are
    all capable of appearing to be "blocking" when presented with a
    file description with the O_NONBLOCK flag set; so there is
    little risk of incompatibility within Ruby-using programs.
    
    The biggest compatibility risk is when spawning external
    programs.  As a result, stdin, stdout, and stderr are now always
    made blocking before exec-family calls.
    
    This change will make an event-oriented MJIT usable if it is
    waiting on pipes on POSIX_like platforms.
    
    It is ALSO necessary to take advantage of (proposed lightweight
    concurrency (aka "auto-Fiber") or any similar proposal for
    network concurrency: https://bugs.ruby-lang.org/issues/13618
    
    Named-pipe (FIFO) are NOT yet non-blocking by default since
    they are rarely-used and may introduce compatibility problems
    and extra syscall overhead for a common path.
    
    Please revert this commit if there are problems and if I am afk
    since I am afk a lot, lately.
    
    [ruby-core:89950] [Bug #14968]

  Modified files:
    trunk/ext/socket/init.c
    trunk/ext/socket/rubysocket.h
    trunk/ext/socket/socket.c
    trunk/io.c
    trunk/process.c
    trunk/spec/ruby/core/io/read_nonblock_spec.rb
    trunk/spec/ruby/core/io/write_nonblock_spec.rb
    trunk/spec/ruby/library/socket/socket/connect_spec.rb
    trunk/test/io/nonblock/test_flush.rb
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_process.rb
    trunk/test/socket/test_basicsocket.rb
    trunk/thread.c
    trunk/win32/win32.c


More information about the ruby-cvs mailing list