diff --git a/src/system/FileDescriptor.cxx b/src/system/FileDescriptor.cxx index fc3d238f3..7fef7ed6b 100644 --- a/src/system/FileDescriptor.cxx +++ b/src/system/FileDescriptor.cxx @@ -222,4 +222,10 @@ FileDescriptor::WaitWritable(int timeout) const noexcept return Poll(POLLOUT, timeout); } +bool +FileDescriptor::IsReadyForWriting() const noexcept +{ + return WaitWritable(0) > 0; +} + #endif diff --git a/src/system/FileDescriptor.hxx b/src/system/FileDescriptor.hxx index f4b5f4548..af05fd1fb 100644 --- a/src/system/FileDescriptor.hxx +++ b/src/system/FileDescriptor.hxx @@ -180,6 +180,9 @@ public: int WaitReadable(int timeout) const noexcept; int WaitWritable(int timeout) const noexcept; + + gcc_pure + bool IsReadyForWriting() const noexcept; #endif };