777b0e0a65
The message.h and mutex.h headers are not used in the libcamera public API. Make them private to avoid there usage in applications, and to prevent having to maintain them with a stable ABI. As mutex.h is used by libcamerasrc, the GStreamer element must switch from the libcamera_public to the libcamera_private dependency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
72 lines
1.2 KiB
C++
72 lines
1.2 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2019, Google Inc.
|
|
*
|
|
* message.h - Message queue support
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <atomic>
|
|
|
|
#include <libcamera/base/private.h>
|
|
|
|
#include <libcamera/base/bound_method.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class BoundMethodBase;
|
|
class Object;
|
|
class Semaphore;
|
|
class Thread;
|
|
|
|
class Message
|
|
{
|
|
public:
|
|
enum Type {
|
|
None = 0,
|
|
InvokeMessage = 1,
|
|
ThreadMoveMessage = 2,
|
|
DeferredDelete = 3,
|
|
UserMessage = 1000,
|
|
};
|
|
|
|
Message(Type type);
|
|
virtual ~Message();
|
|
|
|
Type type() const { return type_; }
|
|
Object *receiver() const { return receiver_; }
|
|
|
|
static Type registerMessageType();
|
|
|
|
private:
|
|
friend class Thread;
|
|
|
|
Type type_;
|
|
Object *receiver_;
|
|
|
|
static std::atomic_uint nextUserType_;
|
|
};
|
|
|
|
class InvokeMessage : public Message
|
|
{
|
|
public:
|
|
InvokeMessage(BoundMethodBase *method,
|
|
std::shared_ptr<BoundMethodPackBase> pack,
|
|
Semaphore *semaphore = nullptr,
|
|
bool deleteMethod = false);
|
|
~InvokeMessage();
|
|
|
|
Semaphore *semaphore() const { return semaphore_; }
|
|
|
|
void invoke();
|
|
|
|
private:
|
|
BoundMethodBase *method_;
|
|
std::shared_ptr<BoundMethodPackBase> pack_;
|
|
Semaphore *semaphore_;
|
|
bool deleteMethod_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|