SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
AsyncWorker.h
Go to the documentation of this file.
1
/**
2
* \file AsyncWorker.h
3
* \brief Declaration of an async worker thread class
4
* \date May 2024
5
* \authors Marino von Wattenwyl
6
* \copyright http://opensource.org/licenses/GPL-3.0
7
* \remarks Please use clangformat to format the code. See more code style on
8
* https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
9
*/
10
11
#ifndef ASYNC_WORKER_H
12
#define ASYNC_WORKER_H
13
14
#include <thread>
15
#include <atomic>
16
17
//-----------------------------------------------------------------------------
18
//! AsyncWorker implements a async worker thread
19
class
AsyncWorker
20
{
21
public
:
22
virtual
~AsyncWorker
();
23
24
void
start
();
25
void
stop
();
26
bool
isReady
();
27
28
protected
:
29
bool
stopRequested
();
30
void
setReady
();
31
virtual
void
run
();
32
33
private
:
34
std::thread
_thread
;
35
std::atomic_bool
_stop
{
false
};
36
std::atomic_bool
_ready
{
false
};
37
};
38
//-----------------------------------------------------------------------------
39
40
#endif
AsyncWorker
AsyncWorker implements a async worker thread.
Definition:
AsyncWorker.h:20
AsyncWorker::isReady
bool isReady()
if returns true, results are valid to be retrieved
Definition:
AsyncWorker.cpp:36
AsyncWorker::_thread
std::thread _thread
Definition:
AsyncWorker.h:34
AsyncWorker::_ready
std::atomic_bool _ready
Definition:
AsyncWorker.h:36
AsyncWorker::setReady
void setReady()
Definition:
AsyncWorker.cpp:47
AsyncWorker::run
virtual void run()
Definition:
AsyncWorker.cpp:52
AsyncWorker::_stop
std::atomic_bool _stop
Definition:
AsyncWorker.h:35
AsyncWorker::start
void start()
Definition:
AsyncWorker.cpp:20
AsyncWorker::stop
void stop()
Definition:
AsyncWorker.cpp:26
AsyncWorker::stopRequested
bool stopRequested()
Definition:
AsyncWorker.cpp:41
AsyncWorker::~AsyncWorker
virtual ~AsyncWorker()
Definition:
AsyncWorker.cpp:15
modules
utils
source
AsyncWorker.h
Generated by
1.9.1