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::WorkerThread Class Reference

#include <WorkerThread.h>

Public Member Functions

 WorkerThread ()
 ~WorkerThread ()
void run (std::function< bool()> workFunc)
void cancel ()
std::thread::id getThreadId () const

Detailed Description

Executes work on a single thread. Stays alive sleeping while there is no work to be done.

Constructor & Destructor Documentation

◆ WorkerThread()

alexaClientSDK::avsCommon::utils::threading::WorkerThread::WorkerThread ( )

Construct a worker thread.

◆ ~WorkerThread()

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

Destruct a worker thread.

Member Function Documentation

◆ cancel()

void alexaClientSDK::avsCommon::utils::threading::WorkerThread::cancel ( )

Cancel currently running work. If work is not running, the call has no effect.

◆ getThreadId()

std::thread::id alexaClientSDK::avsCommon::utils::threading::WorkerThread::getThreadId ( ) const

Return thread id.

Thread id for the allocated thread.

◆ run()

void alexaClientSDK::avsCommon::utils::threading::WorkerThread::run ( std::function< bool()>  workFunc)

Perform work on this worker thread until the work is complete or cancel is called.

workFuncthe work function, which shall be called repeatedly while the workFunc returns true or until cancel() is called.

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