mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +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:
parent
1587caef84
commit
411d36719e
24 changed files with 80 additions and 99 deletions
|
@ -15,7 +15,7 @@ namespace Chess::UCI {
|
|||
Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out)
|
||||
: m_in(in)
|
||||
, m_out(out)
|
||||
, m_in_notifier(Core::Notifier::construct(in->fd(), Core::Notifier::Read))
|
||||
, m_in_notifier(Core::Notifier::construct(in->fd(), Core::Notifier::Type::Read))
|
||||
{
|
||||
set_in_notifier();
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ void Endpoint::custom_event(Core::CustomEvent& custom_event)
|
|||
|
||||
void Endpoint::set_in_notifier()
|
||||
{
|
||||
m_in_notifier = Core::Notifier::construct(m_in->fd(), Core::Notifier::Read);
|
||||
m_in_notifier->on_ready_to_read = [this] {
|
||||
m_in_notifier = Core::Notifier::construct(m_in->fd(), Core::Notifier::Type::Read);
|
||||
m_in_notifier->on_activation = [this] {
|
||||
if (!m_in->can_read_line()) {
|
||||
Core::EventLoop::current().post_event(*this, make<Core::CustomEvent>(EndpointEventType::UnexpectedEof));
|
||||
m_in_notifier->set_enabled(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue