• Ian Lance Taylor's avatar
    os: use poller for file I/O · c05b06a1
    Ian Lance Taylor authored
    This changes the os package to use the runtime poller for file I/O
    where possible. When a system call blocks on a pollable descriptor,
    the goroutine will be blocked on the poller but the thread will be
    released to run other goroutines. When using a non-pollable
    descriptor, the os package will continue to use thread-blocking system
    calls as before.
    
    For example, on GNU/Linux, the runtime poller uses epoll. epoll does
    not support ordinary disk files, so they will continue to use blocking
    I/O as before. The poller will be used for pipes.
    
    Since this means that the poller is used for many more programs, this
    modifies the runtime to only block waiting for the poller if there is
    some goroutine that is waiting on the poller. Otherwise, there is no
    point, as the poller will never make any goroutine ready. This
    preserves the runtime's current simple deadlock detection.
    
    This seems to crash FreeBSD systems, so it is disabled on FreeBSD.
    This is issue 19093.
    
    Using the poller on Windows r...
    c05b06a1
netpoll_windows.go 3.66 KB