From 0c3fd6eb14fe83e62793eaed552529d21790195f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Aug 2019 15:42:18 +0300 Subject: libcamera: event_notifier: Bind event notifiers to threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EventNotifier instances are registered with the event dispatcher instance of the CameraManager. This makes it impossible to use event notifiers 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/event_notifier.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/event_notifier.h b/include/libcamera/event_notifier.h index 1e9b6da1..f80945c7 100644 --- a/include/libcamera/event_notifier.h +++ b/include/libcamera/event_notifier.h @@ -7,11 +7,14 @@ #ifndef __LIBCAMERA_EVENT_NOTIFIER_H__ #define __LIBCAMERA_EVENT_NOTIFIER_H__ +#include #include namespace libcamera { -class EventNotifier +class Message; + +class EventNotifier : public Object { public: enum Type { @@ -31,6 +34,9 @@ public: Signal activated; +protected: + void message(Message *msg) override; + private: int fd_; Type type_; -- cgit v1.2.1