Loading system/gd/os/alarm.h +2 −2 Original line number Diff line number Diff line Loading @@ -42,13 +42,13 @@ class Alarm { DISALLOW_COPY_AND_ASSIGN(Alarm); // Schedule the alarm with given delay void Schedule(OnceClosure task, std::chrono::milliseconds delay); void Schedule(common::OnceClosure task, std::chrono::milliseconds delay); // Cancel the alarm. No-op if it's not armed. void Cancel(); private: OnceClosure task_; common::OnceClosure task_; Handler* handler_; int fd_ = 0; Reactor::Reactable* token_; Loading system/gd/os/handler.h +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class Handler : public common::IPostableContext { DISALLOW_COPY_AND_ASSIGN(Handler); // Enqueue a closure to the queue of this handler virtual void Post(OnceClosure closure) override; virtual void Post(common::OnceClosure closure) override; // Remove all pending events from the queue of this handler void Clear(); Loading Loading @@ -90,7 +90,7 @@ class Handler : public common::IPostableContext { inline bool was_cleared() const { return tasks_ == nullptr; }; std::queue<OnceClosure>* tasks_; std::queue<common::OnceClosure>* tasks_; Thread* thread_; int fd_; Reactor::Reactable* reactable_; Loading system/gd/os/linux_generic/alarm.cc +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ namespace bluetooth { namespace os { using common::Closure; using common::OnceClosure; Alarm::Alarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOCK, 0)) { ASSERT_LOG(fd_ != -1, "cannot create timerfd: %s", strerror(errno)); Loading system/gd/os/linux_generic/handler.cc +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ namespace bluetooth { namespace os { using common::OnceClosure; Handler::Handler(Thread* thread) : tasks_(new std::queue<OnceClosure>()), thread_(thread), fd_(eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK)) { Loading system/gd/os/linux_generic/handler_unittest.cc +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ TEST_F(HandlerTest, post_task_invoked) { int val = 0; std::promise<void> closure_ran; auto future = closure_ran.get_future(); OnceClosure closure = common::BindOnce( common::OnceClosure closure = common::BindOnce( [](int* val, std::promise<void> closure_ran) { *val = *val + 1; closure_ran.set_value(); Loading Loading
system/gd/os/alarm.h +2 −2 Original line number Diff line number Diff line Loading @@ -42,13 +42,13 @@ class Alarm { DISALLOW_COPY_AND_ASSIGN(Alarm); // Schedule the alarm with given delay void Schedule(OnceClosure task, std::chrono::milliseconds delay); void Schedule(common::OnceClosure task, std::chrono::milliseconds delay); // Cancel the alarm. No-op if it's not armed. void Cancel(); private: OnceClosure task_; common::OnceClosure task_; Handler* handler_; int fd_ = 0; Reactor::Reactable* token_; Loading
system/gd/os/handler.h +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class Handler : public common::IPostableContext { DISALLOW_COPY_AND_ASSIGN(Handler); // Enqueue a closure to the queue of this handler virtual void Post(OnceClosure closure) override; virtual void Post(common::OnceClosure closure) override; // Remove all pending events from the queue of this handler void Clear(); Loading Loading @@ -90,7 +90,7 @@ class Handler : public common::IPostableContext { inline bool was_cleared() const { return tasks_ == nullptr; }; std::queue<OnceClosure>* tasks_; std::queue<common::OnceClosure>* tasks_; Thread* thread_; int fd_; Reactor::Reactable* reactable_; Loading
system/gd/os/linux_generic/alarm.cc +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ namespace bluetooth { namespace os { using common::Closure; using common::OnceClosure; Alarm::Alarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOCK, 0)) { ASSERT_LOG(fd_ != -1, "cannot create timerfd: %s", strerror(errno)); Loading
system/gd/os/linux_generic/handler.cc +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ namespace bluetooth { namespace os { using common::OnceClosure; Handler::Handler(Thread* thread) : tasks_(new std::queue<OnceClosure>()), thread_(thread), fd_(eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK)) { Loading
system/gd/os/linux_generic/handler_unittest.cc +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ TEST_F(HandlerTest, post_task_invoked) { int val = 0; std::promise<void> closure_ran; auto future = closure_ran.get_future(); OnceClosure closure = common::BindOnce( common::OnceClosure closure = common::BindOnce( [](int* val, std::promise<void> closure_ran) { *val = *val + 1; closure_ran.set_value(); Loading