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:
@@ -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__ */
|
||||
Reference in New Issue
Block a user