libcamera: media_device: Add functions to lock device for other processes
Add lock() and unlock() which are backed by lockf() and allow an instance of libcamera to claim exclusive access to a media device. These functions are the base of allowing multiple user of libcamera to coexist in the system without stepping on each other's toes. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -30,6 +30,9 @@ public:
|
||||
void release();
|
||||
bool busy() const { return acquired_; }
|
||||
|
||||
bool lock();
|
||||
void unlock();
|
||||
|
||||
int populate();
|
||||
bool valid() const { return valid_; }
|
||||
|
||||
@@ -58,6 +61,7 @@ private:
|
||||
int fd_;
|
||||
bool valid_;
|
||||
bool acquired_;
|
||||
bool lockOwner_;
|
||||
|
||||
int open();
|
||||
void close();
|
||||
|
||||
Reference in New Issue
Block a user