2019-04-12 00:03:21 +02:00
|
|
|
#include <LibCore/CEvent.h>
|
2019-05-28 11:53:16 +02:00
|
|
|
#include <LibCore/CEventLoop.h>
|
|
|
|
|
#include <LibCore/CNotifier.h>
|
2019-04-10 17:35:43 +02:00
|
|
|
|
|
|
|
|
CNotifier::CNotifier(int fd, unsigned event_mask)
|
|
|
|
|
: m_fd(fd)
|
|
|
|
|
, m_event_mask(event_mask)
|
|
|
|
|
{
|
2019-07-16 15:02:22 +02:00
|
|
|
set_enabled(true);
|
2019-04-10 17:35:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CNotifier::~CNotifier()
|
|
|
|
|
{
|
2019-07-16 15:02:22 +02:00
|
|
|
set_enabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CNotifier::set_enabled(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
if (enabled)
|
|
|
|
|
CEventLoop::register_notifier({}, *this);
|
|
|
|
|
else
|
|
|
|
|
CEventLoop::unregister_notifier({}, *this);
|
2019-04-10 17:35:43 +02:00
|
|
|
}
|