mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
android: Replace scoped_lock<> with libcamera::MutexLocker
The CameraDevice class uses std::scoped_lock<> to guard access to the class' descriptors_ member. std::scoped_lock<> provides a set of features that guarantees safety when locking multiple mutexes in a critical section, while for single locks happening in a scoped block it does not provides benefits compared to the simplest std::unique_lock<> which libcamera provides the MutexLocker type for. Replace usage of std::scoped_lock<> with libcamera::MutexLocker to make the implementation consistent with the rest of the code base. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
1f38e4c73f
commit
ebf8b5e7e0
1 changed files with 3 additions and 2 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "libcamera/internal/formats.h"
|
||||
#include "libcamera/internal/log.h"
|
||||
#include "libcamera/internal/thread.h"
|
||||
#include "libcamera/internal/utils.h"
|
||||
|
||||
#include "system/graphics.h"
|
||||
|
@ -2003,7 +2004,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
|
|||
worker_.queueRequest(descriptor.request_.get());
|
||||
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(mutex_);
|
||||
MutexLocker lock(mutex_);
|
||||
descriptors_[descriptor.request_->cookie()] = std::move(descriptor);
|
||||
}
|
||||
|
||||
|
@ -2014,7 +2015,7 @@ void CameraDevice::requestComplete(Request *request)
|
|||
{
|
||||
decltype(descriptors_)::node_type node;
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(mutex_);
|
||||
MutexLocker lock(mutex_);
|
||||
auto it = descriptors_.find(request->cookie());
|
||||
if (it == descriptors_.end()) {
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue