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.

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


◆ ~MultiTimer()

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


Member Function Documentation

◆ cancelTask()

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

Removes a task from the queue.

tokenThe token used to identify the task to be canceled.

◆ createMultiTimer()

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

Factory method that creates a shared pointer to a MultiTimer.

A new instance of MultiTimer.

◆ submitTask()

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.

delayThe non-negative time to wait before calling the given task.
taskThe task to be executed.
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, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0