system/FileDescriptor: add method IsReadyForWriting()

This commit is contained in:
Max Kellermann 2017-08-10 11:53:43 +02:00
parent d310f3e9b7
commit 33bd9e80bb
2 changed files with 9 additions and 0 deletions

View File

@ -222,4 +222,10 @@ FileDescriptor::WaitWritable(int timeout) const noexcept
return Poll(POLLOUT, timeout);
}
bool
FileDescriptor::IsReadyForWriting() const noexcept
{
return WaitWritable(0) > 0;
}
#endif

View File

@ -180,6 +180,9 @@ public:
int WaitReadable(int timeout) const noexcept;
int WaitWritable(int timeout) const noexcept;
gcc_pure
bool IsReadyForWriting() const noexcept;
#endif
};