20#include <condition_variable>
37template<
typename T,
typename... Params>
39 T *obj,
void (T::*f)(
const Params&...),
const Params&... params) {
40 return makeSafeCallback<T>(obj,
41 [f, params...](T *me) { (me->*f)(params...); });
44template<
typename T,
typename... Params>
46 T *obj,
void (T::*f)(Params...),
const Params&... params) {
47 return makeSafeCallback<T>(obj,
48 [f, params...](T *me) { (me->*f)(params...); });
72 std::chrono::steady_clock::time_point
when;
Definition: thread_looper.h:51
bool stopped_
Definition: thread_looper.h:79
void ThreadLoop()
Definition: thread_looper.cpp:84
void Stop()
Definition: thread_looper.cpp:114
void Insert(const Event &event)
Definition: thread_looper.cpp:72
std::mutex lock_
Definition: thread_looper.h:82
std::condition_variable cond_
Definition: thread_looper.h:83
std::function< void()> Callback
Definition: thread_looper.h:59
ThreadLooper()
Definition: thread_looper.cpp:22
bool CancelSerial(Serial serial)
Definition: thread_looper.cpp:55
ThreadLooper & operator=(const ThreadLooper &)=delete
std::thread looper_thread_
Definition: thread_looper.h:80
~ThreadLooper()
Definition: thread_looper.cpp:27
std::deque< Event > queue_
Definition: thread_looper.h:84
ThreadLooper(const ThreadLooper &)=delete
Serial Post(Callback cb)
Definition: thread_looper.cpp:33
int32_t Serial
Definition: thread_looper.h:60
std::atomic< Serial > next_serial_
Definition: thread_looper.h:85
static const char * serial
Definition: fastboot.cpp:96
Event event
Definition: kernel_log_server.cc:56
Definition: alloc_utils.cpp:23
std::function< void()> makeSafeCallback(T *me, std::function< void(T *)> f)
Definition: thread_looper.h:29
Definition: thread_looper.h:71
Callback cb
Definition: thread_looper.h:73
bool operator<=(const Event &other) const
Definition: thread_looper.cpp:29
std::chrono::steady_clock::time_point when
Definition: thread_looper.h:72
Serial serial
Definition: thread_looper.h:74