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>
This commit is contained in:
Laurent Pinchart
2019-03-24 03:21:28 +02:00
parent 525b19c410
commit 01b930964a
7 changed files with 354 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* message.h - Message queue support
*/
#ifndef __LIBCAMERA_MESSAGE_H__
#define __LIBCAMERA_MESSAGE_H__
namespace libcamera {
class Object;
class Thread;
class Message
{
public:
enum Type {
None = 0,
};
Message(Type type);
virtual ~Message();
Type type() const { return type_; }
Object *receiver() const { return receiver_; }
private:
friend class Thread;
Type type_;
Object *receiver_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_MESSAGE_H__ */