8#include "Arp/System/Commons/Threading/Thread.hpp"
10namespace Arp {
namespace System {
namespace Commons {
namespace Threading
22 template<
class TInstance,
class TFunction>
23 WorkerThread(TInstance& instance, TFunction fn,
int idleTime,
const char* threadName);
25 template<
class TInstance,
class TFunction>
26 WorkerThread(
const TInstance& instance, TFunction fn,
int idleTime,
const char* threadName);
28 template<
class TInstance,
class TFunction>
29 WorkerThread(TInstance* pInstance, TFunction fn,
int idleTime,
const char* threadName);
31 template<
class TInstance,
class TFunction>
32 WorkerThread(
const TInstance* pInstance, TFunction fn,
int idleTime,
const char* threadName);
34 template<
class TInstance,
class TFunction>
37 template<
class TInstance,
class TFunction>
40 template<
class TInstance,
class TFunction>
43 template<
class TInstance,
class TFunction>
63 static void RunInternal(
void* pParam);
68 std::atomic<bool> stopWorking{
false};
69 std::atomic<bool> isStarted{
false};
82template<
class TInstance,
class TFunction>
94template<
class TInstance,
class TFunction>
106template<
class TInstance,
class TFunction>
110 , work(make_delegate(pInstance, fn))
120template<
class TInstance,
class TFunction>
124 , work(make_delegate(pInstance, fn))
134template<
class TInstance,
class TFunction>
146template<
class TInstance,
class TFunction>
158template<
class TInstance,
class TFunction>
160 : thread(settings, &
WorkerThread::RunInternal, (void*)this)
161 , idleTime(idleTimeArg)
162 , work(make_delegate(pInstance, fn))
172template<
class TInstance,
class TFunction>
174 : thread(settings, &
WorkerThread::RunInternal, (void*)this)
175 , idleTime(idleTimeArg)
176 , work(make_delegate(pInstance, fn))
Prototyping of delegate template.
Definition: delegate.hxx:14
Container class for adaptable thread settings.
Definition: ThreadSettings.hpp:13
The Thread-class provides methods to execute functions and methods in a separate thread.
Definition: Thread.hpp:68
Worker threads repeat the execution of the threaded code until Stop is called.
Definition: WorkerThread.hpp:15
bool IsRunning(void) const
Checks if the thread is in running state.
Definition: WorkerThread.cpp:80
void Start(void)
Starts the execution of the thread.
Definition: WorkerThread.cpp:37
void Stop(void)
Stops the execution of the thread syncronously.
Definition: WorkerThread.cpp:53
~WorkerThread(void)=default
Deallocates the memory used for this instance but does not quit the thread.
WorkerThread(TInstance &instance, TFunction fn, int idleTime, const char *threadName)
Constructs an WorkerThread instance for a class method.
Definition: WorkerThread.hpp:83
Root namespace for the PLCnext API