libcamera: camera: Add acquire() and release()

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>
This commit is contained in:
Laurent Pinchart 2018-12-19 02:21:28 +02:00 committed by Niklas Söderlund
parent 51d442d5a1
commit ff96eb2ebb
2 changed files with 43 additions and 1 deletions

View file

@ -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 */