Lely core libraries  2.2.5
thrd_loop.hpp
Go to the documentation of this file.
1 
24 #ifndef LELY_EV_THRD_LOOP_HPP_
25 #define LELY_EV_THRD_LOOP_HPP_
26 
27 #include <lely/ev/exec.hpp>
28 #include <lely/ev/thrd_loop.h>
29 
30 namespace lely {
31 namespace ev {
32 
34 class ThreadLoop : public Executor {
35  public:
37  static Executor
38  get_executor() noexcept {
40  }
41 
43  static void
44  stop() noexcept {
46  }
47 
49  static bool
50  stopped() noexcept {
51  return ev_thrd_loop_stopped() != 0;
52  }
53 
55  static void
56  restart() noexcept {
58  }
59 
61  static ::std::size_t
62  run() noexcept {
63  return ev_thrd_loop_run();
64  }
65 
67  static ::std::size_t
68  run_one() noexcept {
69  return ev_thrd_loop_run_one();
70  }
71 };
72 
73 } // namespace ev
74 } // namespace lely
75 
76 #endif // !LELY_EV_THRD_LOOP_HPP_
ev_thrd_loop_stopped
int ev_thrd_loop_stopped(void)
Returns 1 if the thread-local event loop is stopped, and 0 if not.
Definition: thrd_loop.c:89
lely::ev::ThreadLoop::restart
static void restart() noexcept
Definition: thrd_loop.hpp:56
ev_thrd_loop_run_one
size_t ev_thrd_loop_run_one(void)
If the thread-local event loop is not stopped, executes the first task submitted to it,...
Definition: thrd_loop.c:110
ev_thrd_loop_restart
void ev_thrd_loop_restart(void)
Restarts a thread-local event loop.
Definition: thrd_loop.c:95
lely::ev::ThreadLoop::run
::std::size_t run() noexcept
Definition: thrd_loop.hpp:62
lely::ev::ThreadLoop
The thread-local event loop.
Definition: thrd_loop.hpp:34
lely::ev::Executor
An abstract task executor. This class is a wrapper around #ev_exec_t*.
Definition: exec.hpp:38
lely::ev::ThreadLoop::stop
static void stop() noexcept
Definition: thrd_loop.hpp:44
ev_thrd_loop_stop
void ev_thrd_loop_stop(void)
Stops the thread-local event loop.
Definition: thrd_loop.c:83
lely::ev::ThreadLoop::run_one
::std::size_t run_one() noexcept
Definition: thrd_loop.hpp:68
ev_thrd_loop_get_exec
ev_exec_t * ev_thrd_loop_get_exec(void)
Returns a pointer to the executor corresponding to the thread-local event loop.
Definition: thrd_loop.c:75
lely::ev::ThreadLoop::stopped
static bool stopped() noexcept
Definition: thrd_loop.hpp:50
lely::ev::ThreadLoop::get_executor
static Executor get_executor() noexcept
Definition: thrd_loop.hpp:38
exec.hpp
thrd_loop.h
ev_thrd_loop_run
size_t ev_thrd_loop_run(void)
If the thread-local event loop is not stopped, run all available tasks.
Definition: thrd_loop.c:101