ADTF
Loading...
Searching...
No Matches
kernel_thread_loop.h
Go to the documentation of this file.
1
7#pragma once
8#include "kernel_thread.h"
9
10
11namespace adtf
12{
13
14namespace system
15{
16
21class kernel_thread_looper: public kernel_thread, public adtf_util::cLooper
22{
23 public:
24 kernel_thread_looper() = default;
25
26 kernel_thread_looper(const kernel_thread_looper&) = delete;
27
28 template<typename ...Args>
29 kernel_thread_looper(const char* strName, Args&&... args): cLooper(std::forward<Args>(args)...)
30 {
31 *static_cast<kernel_thread*>(this) = kernel_thread(strName, GetCallable());
32 }
33
34 template<typename ...Args>
35 kernel_thread_looper(const adtf::services::IKernel::tSchedulingInfo& sScheduling,
36 const char* strName, Args&&... args): cLooper(std::forward<Args>(args)...)
37 {
38 *static_cast<kernel_thread*>(this) = kernel_thread(sScheduling, strName, GetCallable());
39 }
40
41 kernel_thread_looper(kernel_thread_looper&& oOther):
42 kernel_thread(static_cast<kernel_thread&&>(oOther)),
43 cLooper(static_cast<cLooper&&>(oOther))
44 {
45 }
46
47 kernel_thread_looper& operator=(kernel_thread_looper&& oOther)
48 {
49 kernel_thread::Swap(oOther);
50 cLooper::Swap(oOther);
51 return *this;
52 }
53};
54
61{
62 private:
63 kernel_thread_looper m_oLooper;
64 bool m_bSelfDestruct;
65
66 public:
67 using tLoopState = adtf_util::cLooper::tLoopState;
68
73
85 tResult Create(const char *strName, const adtf::services::IKernel::tSchedulingInfo &sScheduling =
86 adtf::services::IKernel::tSchedulingInfo(), bool bSelfDestruct = false,
87 tLoopState eInitialState = tLoopState::Running);
88
96
101 tLoopState GetState();
102
109 tResult SetState(tLoopState eState, bool bWaitForAck = true);
110
111 private:
112 void Loop();
113
114 private:
115 void SelfDestruct();
116
117 protected:
123 virtual tResult LoopFunc() = 0;
124};
125
126}
127
128}
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition kernel_thread_loop.h:61
tResult SetState(tLoopState eState, bool bWaitForAck=true)
virtual tResult LoopFunc()=0
tResult Create(const char *strName, const adtf::services::IKernel::tSchedulingInfo &sScheduling=adtf::services::IKernel::tSchedulingInfo(), bool bSelfDestruct=false, tLoopState eInitialState=tLoopState::Running)
Definition kernel_thread_loop.h:22
void Swap(kernel_thread &oOther)
Namespace for the ADTF System SDK.
Definition adtf_service.h:14
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14