EventLoop.h 537 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Function.h>
  8. #include <LibWeb/HTML/EventLoop/TaskQueue.h>
  9. namespace Web::HTML {
  10. class EventLoop {
  11. public:
  12. EventLoop();
  13. ~EventLoop();
  14. TaskQueue& task_queue() { return m_task_queue; }
  15. TaskQueue const& task_queue() const { return m_task_queue; }
  16. void spin_until(Function<bool()> goal_condition);
  17. private:
  18. TaskQueue m_task_queue;
  19. };
  20. EventLoop& main_thread_event_loop();
  21. }