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

#include <TaskThread.h>

Public Member Functions

 TaskThread ()
 
 ~TaskThread ()
 
bool start (std::function< bool()> jobRunner, const std::string &moniker)
 

Detailed Description

A TaskThread executes in sequence until no more tasks exists.

Note
It's the caller responsibility to restart the TaskThread if jobRunner returns false.

Constructor & Destructor Documentation

◆ TaskThread()

alexaClientSDK::avsCommon::utils::threading::TaskThread::TaskThread ( )

Constructs a TaskThread to run tasks on a single thread. This does not start the thread.

◆ ~TaskThread()

alexaClientSDK::avsCommon::utils::threading::TaskThread::~TaskThread ( )

Destructs the TaskThread.

Member Function Documentation

◆ start()

bool alexaClientSDK::avsCommon::utils::threading::TaskThread::start ( std::function< bool()>  jobRunner,
const std::string &  moniker 
)

Start executing tasks from the given job runner. The task thread will keep running until jobRunner returns false or start gets called again.

Parameters
jobRunnerFunction that should execute jobs. The function should return true if there's more tasks to be executed.
monikerThread moniker to use when executing jobRunner. All logging messages will use provided moniker for identifying the execution owner.
Returns
true if it succeeds to start the new jobRunner thread; false if it fails.

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