1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibC: Implement pselect

pselect() is similar() to select(), but it takes its timeout
as timespec instead of as timeval, and it takes an additional
sigmask parameter.

Change the sys$select parameters to match pselect() and implement
select() in terms of pselect().
This commit is contained in:
Nico Weber 2020-06-21 13:54:41 -04:00 committed by Andreas Kling
parent 29f509a2a0
commit d23e655c83
6 changed files with 46 additions and 19 deletions

View file

@ -219,12 +219,12 @@ public:
class SelectBlocker final : public Blocker {
public:
typedef Vector<int, FD_SETSIZE> FDVector;
SelectBlocker(const timeval& tv, bool select_has_timeout, const FDVector& read_fds, const FDVector& write_fds, const FDVector& except_fds);
SelectBlocker(const timespec& ts, bool select_has_timeout, const FDVector& read_fds, const FDVector& write_fds, const FDVector& except_fds);
virtual bool should_unblock(Thread&, time_t, long) override;
virtual const char* state_string() const override { return "Selecting"; }
private:
timeval m_select_timeout;
timespec m_select_timeout;
bool m_select_has_timeout { false };
const FDVector& m_select_read_fds;
const FDVector& m_select_write_fds;