80 explicit operator bool();
86 std::atomic<bool> _sentry{
false};
102 template<
typename ClassType,
typename MethodType,
typename Ret>
116 _ret = ((*_cls).*
static_cast<Ret (ClassType::*)()
>(_mtd))();
127 template<
typename ClassType,
typename MethodType,
typename Ret,
typename Arg1>
142 _ret = ((*_cls).*
static_cast<Ret (ClassType::*)(Arg1)
>(_mtd))(_arg1);
154 template<
typename ClassType,
typename MethodType,
typename Ret,
typename Arg1,
typename Arg2>
170 _ret = ((*_cls).*
static_cast<Ret (ClassType::*)(Arg1, Arg2)
>(_mtd))(_arg1, _arg2);
183 template<
typename ClassType,
typename MethodType,
typename Ret,
typename Arg1,
typename Arg2,
typename Arg3>
187 Relay3(
ThreadRelay& tr, ClassType* cls, MethodType mtd, Ret& ret, Arg1& arg1, Arg2& arg2, Arg3& arg3)
200 _ret = ((*_cls).*
static_cast<Ret (ClassType::*)(Arg1, Arg2, Arg3)
>(_mtd))(_arg1, _arg2, _arg3);
214 template<
typename ClassType,
typename MethodType,
typename Ret,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
218 Relay4(
ThreadRelay& tr, ClassType* cls, MethodType mtd, Ret& ret, Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4)
232 _ret = ((*_cls).*
static_cast<Ret (ClassType::*)(Arg1, Arg2, Arg3, Arg4)
>(_mtd))(_arg1, _arg2, _arg3, _arg4);
246 Thread::id_type _threadId;
248 std::vector<RelayBase*> _list{};
Semaphore class built around posix sem_xxx functionality.
Definition Semaphore.h:13
Sync provides a system-independent interface to build classes that act like monitors,...
Definition Sync.h:56
Template for a method having 0 arguments.
Definition ThreadRelay.h:104
Relay0(ThreadRelay &tr, ClassType *cls, MethodType mtd, Ret &ret)
Definition ThreadRelay.h:106
Template for a method having 1 argument.
Definition ThreadRelay.h:129
Relay1(ThreadRelay &tr, ClassType *cls, MethodType mtd, Ret &ret, Arg1 &arg1)
Definition ThreadRelay.h:131
Template for a method having 2 arguments.
Definition ThreadRelay.h:156
Relay2(ThreadRelay &tr, ClassType *cls, MethodType mtd, Ret &ret, Arg1 &arg1, Arg2 &arg2)
Definition ThreadRelay.h:158
Template for a method having 3 arguments.
Definition ThreadRelay.h:185
Relay3(ThreadRelay &tr, ClassType *cls, MethodType mtd, Ret &ret, Arg1 &arg1, Arg2 &arg2, Arg3 &arg3)
Definition ThreadRelay.h:187
Template for a method having 4 arguments.
Definition ThreadRelay.h:216
Relay4(ThreadRelay &tr, ClassType *cls, MethodType mtd, Ret &ret, Arg1 &arg1, Arg2 &arg2, Arg3 &arg3, Arg4 &arg4)
Definition ThreadRelay.h:218
Base class for the ThreadRelay::Relay0,1,2,3 templates for storing in a list.
Definition ThreadRelay.h:59
Semaphore _semaphore
Holds the semaphore to stop the thread until the method is executed.
Definition ThreadRelay.h:94
virtual ~RelayBase()=default
Default virtual destructor.
RelayBase(ThreadRelay &tr)
Constructor.
Definition ThreadRelay.h:251
friend ThreadRelay
Definition ThreadRelay.h:96
virtual void call()=0
Pure virtual function to override in the derived template class to call a method.
ThreadRelay & _tr
Prevents the execution of the method more the once.
Definition ThreadRelay.h:90
Provides a way to stop executing a thread until the main thread enables the thread again.
Definition ThreadRelay.h:37
void makeOwner(Thread::id_type threadId=0)
The calling thread takes thread execution ownership when zero is passed or sets it when not zero.
int checkForWork()
Called by main thread for instance. When a lock of this calling thread is requested.
ThreadRelay()
Default constructor which also sets the thread execution ownership.
pid_t id_type
Local declaration of the thread id type.
Definition Thread.h:41
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10