Skip to content

gunix{input,output}stream: Don't poll() unnecessarily

Philip Withnall requested to merge pwithnall/glib:979-stream-dont-poll into master

Regular files (not pipes or sockets), will always poll() as readable/writable. It's pointless to call poll() on them.

Similarly, if we're doing a synchronous non-cancellable read/write, there's no reason to block in poll() on the fd - just block in read()/write().

I'm writing this patch mainly to make strace on ostree prettier.

Implementation note: the cancellation check is hoisted to the top of the loop, so we still support cancellation for regular files.

Tweaked by Philip Withnall withnall@endlessm.com to modify nfds handling.

#979 (closed)

Closes #979 (closed)

Merge request reports