LibCore: Remove unused methods from EventLoop

This commit is contained in:
Lucas CHOLLET 2025-01-04 22:42:22 -05:00 committed by Andrew Kaster
parent 37e1d6ece1
commit e015a43b51
Notes: github-actions[bot] 2025-01-30 22:35:42 +00:00
9 changed files with 1 additions and 89 deletions

View file

@ -65,11 +65,6 @@ void EventLoop::quit(int code)
m_impl->quit(code); m_impl->quit(code);
} }
void EventLoop::unquit()
{
m_impl->unquit();
}
struct EventLoopPusher { struct EventLoopPusher {
public: public:
EventLoopPusher(EventLoop& event_loop) EventLoopPusher(EventLoop& event_loop)
@ -91,7 +86,7 @@ int EventLoop::exec()
void EventLoop::spin_until(Function<bool()> goal_condition) void EventLoop::spin_until(Function<bool()> goal_condition)
{ {
EventLoopPusher pusher(*this); EventLoopPusher pusher(*this);
while (!m_impl->was_exit_requested() && !goal_condition()) while (!goal_condition())
pump(); pump();
} }
@ -120,11 +115,6 @@ void EventLoop::unregister_signal(int handler_id)
EventLoopManager::the().unregister_signal(handler_id); EventLoopManager::the().unregister_signal(handler_id);
} }
void EventLoop::notify_forked(ForkEvent)
{
current().m_impl->notify_forked_and_in_child();
}
intptr_t EventLoop::register_timer(EventReceiver& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) intptr_t EventLoop::register_timer(EventReceiver& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible)
{ {
return EventLoopManager::the().register_timer(object, milliseconds, should_reload, fire_when_not_visible); return EventLoopManager::the().register_timer(object, milliseconds, should_reload, fire_when_not_visible);
@ -161,9 +151,4 @@ void deferred_invoke(Function<void()> invokee)
EventLoop::current().deferred_invoke(move(invokee)); EventLoop::current().deferred_invoke(move(invokee));
} }
bool EventLoop::was_exit_requested() const
{
return m_impl->was_exit_requested();
}
} }

View file

@ -72,8 +72,6 @@ public:
void wake(); void wake();
void quit(int); void quit(int);
void unquit();
bool was_exit_requested() const;
// The registration functions act upon the current loop of the current thread. // The registration functions act upon the current loop of the current thread.
static intptr_t register_timer(EventReceiver&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible); static intptr_t register_timer(EventReceiver&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible);
@ -85,13 +83,6 @@ public:
static int register_signal(int signo, ESCAPING Function<void(int)> handler); static int register_signal(int signo, ESCAPING Function<void(int)> handler);
static void unregister_signal(int handler_id); static void unregister_signal(int handler_id);
// Note: Boost uses Parent/Child/Prepare, but we don't really have anything
// interesting to do in the parent or before forking.
enum class ForkEvent {
Child,
};
static void notify_forked(ForkEvent);
static bool is_running(); static bool is_running();
static EventLoop& current(); static EventLoop& current();

View file

@ -55,11 +55,6 @@ public:
virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) = 0; virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) = 0;
// FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them.
virtual void unquit() = 0;
virtual bool was_exit_requested() const = 0;
virtual void notify_forked_and_in_child() = 0;
protected: protected:
EventLoopImplementation(); EventLoopImplementation();
ThreadEventQueue& m_thread_event_queue; ThreadEventQueue& m_thread_event_queue;

View file

@ -330,17 +330,6 @@ void EventLoopImplementationUnix::quit(int code)
m_exit_code = code; m_exit_code = code;
} }
void EventLoopImplementationUnix::unquit()
{
m_exit_requested = false;
m_exit_code = 0;
}
bool EventLoopImplementationUnix::was_exit_requested() const
{
return m_exit_requested;
}
void EventLoopImplementationUnix::post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&& event) void EventLoopImplementationUnix::post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&& event)
{ {
m_thread_event_queue.post_event(receiver, move(event)); m_thread_event_queue.post_event(receiver, move(event));
@ -522,21 +511,6 @@ void EventLoopManagerUnix::dispatch_signal(int signal_number)
} }
} }
void EventLoopImplementationUnix::notify_forked_and_in_child()
{
auto& thread_data = ThreadData::the();
thread_data.timeouts.clear();
thread_data.poll_fds.clear();
thread_data.notifier_by_ptr.clear();
thread_data.notifier_by_index.clear();
thread_data.initialize_wake_pipe();
if (auto* info = signals_info<false>()) {
info->signal_handlers.clear();
info->next_signal_id = 0;
}
thread_data.pid = getpid();
}
SignalHandlers::SignalHandlers(int signal_number, void (*handle_signal)(int)) SignalHandlers::SignalHandlers(int signal_number, void (*handle_signal)(int))
: m_signal_number(signal_number) : m_signal_number(signal_number)
, m_original_handler(signal(signal_number, handle_signal)) , m_original_handler(signal(signal_number, handle_signal))

View file

@ -49,9 +49,6 @@ public:
virtual void wake() override; virtual void wake() override;
virtual void unquit() override;
virtual bool was_exit_requested() const override;
virtual void notify_forked_and_in_child() override;
virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) override; virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) override;
private: private:

View file

@ -134,17 +134,6 @@ void EventLoopImplementationWindows::quit(int code)
m_exit_code = code; m_exit_code = code;
} }
void EventLoopImplementationWindows::unquit()
{
m_exit_requested = false;
m_exit_code = 0;
}
bool EventLoopImplementationWindows::was_exit_requested() const
{
return m_exit_requested;
}
void EventLoopImplementationWindows::post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&& event) void EventLoopImplementationWindows::post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&& event)
{ {
m_thread_event_queue.post_event(receiver, move(event)); m_thread_event_queue.post_event(receiver, move(event));
@ -157,12 +146,6 @@ void EventLoopImplementationWindows::wake()
SetEvent(m_wake_event); SetEvent(m_wake_event);
} }
void EventLoopImplementationWindows::notify_forked_and_in_child()
{
dbgln("Core::EventLoopManagerWindows::notify_forked_and_in_child() is not implemented");
VERIFY_NOT_REACHED();
}
static int notifier_type_to_network_event(NotificationType type) static int notifier_type_to_network_event(NotificationType type)
{ {
switch (type) { switch (type) {

View file

@ -42,9 +42,6 @@ public:
virtual void wake() override; virtual void wake() override;
virtual void unquit() override;
virtual bool was_exit_requested() const override;
virtual void notify_forked_and_in_child() override;
virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) override; virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) override;
private: private:

View file

@ -41,11 +41,6 @@ public:
virtual void wake() override; virtual void wake() override;
virtual void post_event(Core::EventReceiver& receiver, NonnullOwnPtr<Core::Event>&&) override; virtual void post_event(Core::EventReceiver& receiver, NonnullOwnPtr<Core::Event>&&) override;
// FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them.
virtual void unquit() override { }
virtual bool was_exit_requested() const override { return false; }
virtual void notify_forked_and_in_child() override { }
private: private:
EventLoopImplementationMacOS() = default; EventLoopImplementationMacOS() = default;

View file

@ -59,11 +59,6 @@ public:
virtual void wake() override; virtual void wake() override;
virtual void post_event(Core::EventReceiver& receiver, NonnullOwnPtr<Core::Event>&&) override; virtual void post_event(Core::EventReceiver& receiver, NonnullOwnPtr<Core::Event>&&) override;
// FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them.
virtual void unquit() override { }
virtual bool was_exit_requested() const override { return false; }
virtual void notify_forked_and_in_child() override { }
void set_main_loop(); void set_main_loop();
private: private: