[ruby-cvs:57814] normal:r50666 (trunk): socket: avoid redundant fcntl on Linux

normal at ruby-lang.org normal at ruby-lang.org
Fri May 29 11:24:19 JST 2015


normal	2015-05-29 11:24:18 +0900 (Fri, 29 May 2015)

  New Revision: 50666

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

  Log:
    socket: avoid redundant fcntl on Linux
    
    * ext/socket/ancdata.c (bsock_sendmsg_internal,
      bsock_recvmsg_internal):
      avoid redundant fcntl on Linux
      [ruby-core:69154] [Feature #11145]
    * ext/socket/init.c (rsock_s_recvfrom_nonblock): ditto
    * ext/socket/rubysocket.h (MSG_DONTWAIT_RELIABLE): new macro
    
    MSG_DONTWAIT is enough to force non-blocking I/O under Linux,
    so avoid changing the state of a socket.  This will allow certain
    threads to do a non-destructive non-blocking "peek" while others
    block (without relying on an extra ppoll syscall).
    
    We shall be conservative about enabling this feature since some
    OSes may have incomplete support for MSG_DONTWAIT.  I shall
    defer to a FreeBSD expert to enable that for FreeBSD.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/ancdata.c
    trunk/ext/socket/init.c
    trunk/ext/socket/rubysocket.h


More information about the ruby-cvs mailing list