summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-03-24 03:21:28 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-11 10:20:15 +0300
commit01b930964acdd9475d46044c459396f8c3cf8a79 (patch)
treee7f4625cd315426dba6da7caa2d559eca458b14c /include
parent525b19c4101235385148ff9358b7b6e778a1f148 (diff)
libcamera: thread: Add a messaging passing API
Create a new Message class to model a message that can be passed to an object living in another thread. Only an invalid message type is currently defined, more messages will be added in the future. The Thread class is extended with a messages queue, and the Object class with thread affinity. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/object.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/libcamera/object.h b/include/libcamera/object.h
index eadd41f9..d61dfb1e 100644
--- a/include/libcamera/object.h
+++ b/include/libcamera/object.h
@@ -8,26 +8,39 @@
#define __LIBCAMERA_OBJECT_H__
#include <list>
+#include <memory>
namespace libcamera {
+class Message;
class SignalBase;
template<typename... Args>
class Signal;
+class Thread;
class Object
{
public:
+ Object();
virtual ~Object();
+ void postMessage(std::unique_ptr<Message> msg);
+ virtual void message(Message *msg);
+
+ Thread *thread() const { return thread_; }
+ void moveToThread(Thread *thread);
+
private:
template<typename... Args>
friend class Signal;
+ friend class Thread;
void connect(SignalBase *signal);
void disconnect(SignalBase *signal);
+ Thread *thread_;
std::list<SignalBase *> signals_;
+ unsigned int pendingMessages_;
};
}; /* namespace libcamera */