libcamera: timer: Allow restarting a timer before expiration
The Timer API allows restarting a timer before expiration. This isn't correctly implemented, fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -75,6 +75,9 @@ void Timer::start(std::chrono::milliseconds duration)
|
||||
<< duration.count() << ": deadline "
|
||||
<< utils::time_point_to_string(deadline_);
|
||||
|
||||
if (isRunning())
|
||||
unregisterTimer();
|
||||
|
||||
registerTimer();
|
||||
}
|
||||
|
||||
@@ -88,6 +91,9 @@ void Timer::start(std::chrono::milliseconds duration)
|
||||
*/
|
||||
void Timer::stop()
|
||||
{
|
||||
if (!isRunning())
|
||||
return;
|
||||
|
||||
unregisterTimer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user