[libcamera-devel] [PATCH 03/10] libcamera: thread: Prevent aliasing of signal name

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Oct 14 14:23:13 CEST 2020


Hi Kieran,

On 2020-10-13 16:12:34 +0100, Kieran Bingham wrote:
> The Thread::wait() function creates a boolean flag 'finished' which
> aliases the internal member signal of the same name.
> 
> Rename the boolean flag to prevent confusion and aliasing of the signal.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  src/libcamera/thread.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp
> index 87006a9c4301..b5d7103ad341 100644
> --- a/src/libcamera/thread.cpp
> +++ b/src/libcamera/thread.cpp
> @@ -374,7 +374,7 @@ void Thread::exit(int code)
>   */
>  bool Thread::wait(utils::duration duration)
>  {
> -	bool finished = true;
> +	bool hasFinished = true;
>  
>  	{
>  		MutexLocker locker(data_->mutex_);
> @@ -382,14 +382,14 @@ bool Thread::wait(utils::duration duration)
>  		if (duration == utils::duration::max())
>  			data_->cv_.wait(locker, [&]() { return !data_->running_; });
>  		else
> -			finished = data_->cv_.wait_for(locker, duration,
> -						       [&]() { return !data_->running_; });
> +			hasFinished = data_->cv_.wait_for(locker, duration,
> +							  [&]() { return !data_->running_; });
>  	}
>  
>  	if (thread_.joinable())
>  		thread_.join();
>  
> -	return finished;
> +	return hasFinished;
>  }
>  
>  /**
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list