summaryrefslogtreecommitdiff
path: root/src/libcamera/include/thread.h
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 /src/libcamera/include/thread.h
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 'src/libcamera/include/thread.h')
-rw-r--r--src/libcamera/include/thread.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcamera/include/thread.h b/src/libcamera/include/thread.h
index e881d90e..acae91cb 100644
--- a/src/libcamera/include/thread.h
+++ b/src/libcamera/include/thread.h
@@ -16,6 +16,8 @@
namespace libcamera {
class EventDispatcher;
+class Message;
+class Object;
class ThreadData;
class ThreadMain;
@@ -49,9 +51,16 @@ private:
void startThread();
void finishThread();
+ void postMessage(std::unique_ptr<Message> msg, Object *receiver);
+ void removeMessages(Object *receiver);
+ void dispatchMessages();
+
+ friend class Object;
friend class ThreadData;
friend class ThreadMain;
+ void moveObject(Object *object);
+
std::thread thread_;
ThreadData *data_;
};