1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

Kernel: Avoid allocations for Select vectors by using inline capacity

Good tip by Andreas :)
This commit is contained in:
Robin Burchell 2019-07-19 09:04:12 +02:00 committed by Andreas Kling
parent 52743f9eec
commit 750dbe986d
3 changed files with 13 additions and 11 deletions

View file

@ -10,6 +10,7 @@
#include <Kernel/KResult.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/VM/Region.h>
#include <LibC/fd_set.h>
class Alarm;
class FileDescription;
@ -135,15 +136,16 @@ public:
class SelectBlocker : public Blocker {
public:
SelectBlocker(const timeval& tv, bool select_has_timeout, const Vector<int>& read_fds, const Vector<int>& write_fds, const Vector<int>& except_fds);
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);
virtual bool should_unblock(Thread&, time_t, long) override;
private:
timeval m_select_timeout;
bool m_select_has_timeout { false };
const Vector<int>& m_select_read_fds;
const Vector<int>& m_select_write_fds;
const Vector<int>& m_select_exceptional_fds;
const FDVector& m_select_read_fds;
const FDVector& m_select_write_fds;
const FDVector& m_select_exceptional_fds;
};
class WaitBlocker : public Blocker {