AlexaClientSDK  1.25.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 ()
 
 ~MultiTimer ()
 
Token submitTask (const std::chrono::milliseconds &delay, std::function< void()> task)
 
void cancelTask (Token token)
 

Static Public Member Functions

static std::shared_ptr< MultiTimercreateMultiTimer ()
 

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 ( )

Constructor.

◆ ~MultiTimer()

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

Destructor.

Member Function Documentation

◆ cancelTask()

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

Removes a task from the queue.

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

◆ createMultiTimer()

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

Factory method that creates a shared pointer to a MultiTimer.

Returns
A new instance of MultiTimer.

◆ submitTask()

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

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 files:

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