1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibCore: Simplify Core::Notifier by only allowing one event type

Not a single client of this API actually used the event mask feature to
listen for readability AND writability.

Let's simplify the API and have only one hook: on_activation.
This commit is contained in:
Andreas Kling 2023-04-23 20:59:32 +02:00
parent 1587caef84
commit 411d36719e
24 changed files with 80 additions and 99 deletions

View file

@ -21,7 +21,7 @@ Client::Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd)
: m_id(id)
, m_socket(move(socket))
, m_ptm_fd(ptm_fd)
, m_ptm_notifier(Core::Notifier::construct(ptm_fd, Core::Notifier::Read))
, m_ptm_notifier(Core::Notifier::construct(ptm_fd, Core::Notifier::Type::Read))
{
m_socket->on_ready_to_read = [this] {
auto result = drain_socket();
@ -31,7 +31,7 @@ Client::Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd)
}
};
m_ptm_notifier->on_ready_to_read = [this] {
m_ptm_notifier->on_activation = [this] {
auto result = drain_pty();
if (result.is_error()) {
dbgln("Failed to drain the PTY: {}", result.error());