AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::utils::timing::MultiTimer Class Reference

#include <MultiTimer.h>

Public Types

using Token = uint64_t
 Alias for the token used to identify a task. This can be used to cancel a task execution. More...
 

Public Member Functions

 MultiTimer () noexcept
 
 ~MultiTimer () noexcept
 
Token submitTask (const std::chrono::milliseconds &delay, std::function< void()> task) noexcept
 
void cancelTask (Token token) noexcept
 

Static Public Member Functions

static std::shared_ptr< MultiTimercreateMultiTimer () noexcept
 

Detailed Description

A MultiTimer is used to schedule multiple callable types to run in the future.

Note
The executed function should not block since this may cause delays to trigger other tasks in the queue.

Member Typedef Documentation

◆ Token

Alias for the token used to identify a task. This can be used to cancel a task execution.

Constructor & Destructor Documentation

◆ MultiTimer()

alexaClientSDK::avsCommon::utils::timing::MultiTimer::MultiTimer ( )
noexcept

Constructor.

◆ ~MultiTimer()

alexaClientSDK::avsCommon::utils::timing::MultiTimer::~MultiTimer ( )
noexcept

Destructor.

Member Function Documentation

◆ cancelTask()

void alexaClientSDK::avsCommon::utils::timing::MultiTimer::cancelTask ( Token  token)
noexcept

Removes a task from the queue.

Parameters
tokenThe token used to identify the task to be canceled.

◆ createMultiTimer()

static std::shared_ptr<MultiTimer> alexaClientSDK::avsCommon::utils::timing::MultiTimer::createMultiTimer ( )
staticnoexcept

Factory method that creates a shared pointer to a MultiTimer.

Returns
A new instance of MultiTimer.

◆ submitTask()

Token alexaClientSDK::avsCommon::utils::timing::MultiTimer::submitTask ( const std::chrono::milliseconds &  delay,
std::function< void()>  task 
)
noexcept

Submits a task to be executed after a given delay.

This function take longer than the delay due to scheduling or resource contention.

Parameters
delayThe non-negative time to wait before calling the given task.
taskThe task to be executed.
Returns
A unique token that can be used to cancel this task.

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0