From ff96eb2ebb714cef37de8e2ff19c3e56ba8bc91b Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Wed, 19 Dec 2018 02:21:28 +0200
Subject: libcamera: camera: Add acquire() and release()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Exclusive access must be obtained before performing operations that
change the device state. Define an internal flag to track ownership and
provide a means of protecting functions that change device
configuration.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/camera.h | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'include')

diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
index 5ad8a09f..a2635402 100644
--- a/include/libcamera/camera.h
+++ b/include/libcamera/camera.h
@@ -29,6 +29,9 @@ public:
 
 	Signal<Camera *> disconnected;
 
+	int acquire();
+	void release();
+
 private:
 	Camera(PipelineHandler *pipe, const std::string &name);
 	~Camera();
@@ -38,6 +41,8 @@ private:
 
 	std::shared_ptr<PipelineHandler> pipe_;
 	std::string name_;
+
+	bool acquired_;
 };
 
 } /* namespace libcamera */
-- 
cgit v1.2.1