From 6ecf99a708936c4b7a33ad6296baa04e9975abb2 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Aug 2019 15:42:18 +0300 Subject: libcamera: timer: Bind timers to threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Timer instances are registered with the event dispatcher instance of the CameraManager. This makes it impossible to use timers in other threads. Fix this by inheriting from Object, which allows binding instances to a thread, and register them with the event dispatcher for the thread they are bound to. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- include/libcamera/timer.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/timer.h b/include/libcamera/timer.h index f082339b..853808e0 100644 --- a/include/libcamera/timer.h +++ b/include/libcamera/timer.h @@ -9,11 +9,14 @@ #include +#include #include namespace libcamera { -class Timer +class Message; + +class Timer : public Object { public: Timer(); @@ -28,7 +31,13 @@ public: Signal timeout; +protected: + void message(Message *msg) override; + private: + void registerTimer(); + void unregisterTimer(); + unsigned int interval_; uint64_t deadline_; }; -- cgit v1.2.1