8 #include "RtosTask.hpp"
10 #include "RtosPortable.hpp"
11 #include "RtosHeap.hpp"
12 #include "RtosMacros.hpp"
24 mCurrentStackPointer = RtosPortable::stackInit(mStack, stackSize, (
void (*)(
void*))run,
this);
38 mCurrentStackPointer = RtosPortable::stackInit(mStack, stackSize, (
void (*)(
void*))
caller, &runnable);
45 RtosTask::~RtosTask() {
58 mIterableCore.mSortValue = mPriority;
59 mIterableCore.mTaskOwner =
this;
60 mIterableSyncObj.mTaskOwner =
this;
62 mStackSize = stackSize;
76 void RtosTask::suspend() {
77 RtosPortable::enterCriticalSection();
78 if (mIterableSyncObj.mListOwner) {
79 mIterableSyncObj.mListOwner->
remove(mIterableSyncObj);
81 mIterableCore.mListOwner->
remove(mIterableCore);
83 RtosPortable::yield();
84 RtosPortable::exitCriticalSection();
90 void RtosTask::resume() {
91 RtosPortable::enterCriticalSection();
92 if (mIterableSyncObj.mListOwner) {
93 mIterableSyncObj.mListOwner->
remove(mIterableSyncObj);
95 mIterableCore.mListOwner->
remove(mIterableCore);
97 RtosPortable::yield();
98 RtosPortable::exitCriticalSection();
122 return RtosPortable::getFreeStackSize(mStack, mStackSize);