Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify thread resuming #130

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions Sts1CobcSw/EduCommunicationErrorThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,9 @@ class EduCommunicationErrorThread : public RODOS::StaticThread<stackSize>
}
} eduCommunicationErrorThread;


// TODO: Think about whether this is the right way to declare, design, use, etc. this
class ResumeEduErrorCommunicationThread : public RODOS::TimeEvent
{
public:
auto handle() -> void override
{
eduCommunicationErrorThread.resume();
RODOS::PRINTF("[EduCommunicationErrorThread] EduCommunicationThread resumed\n");
}
} resumeEduErrorCommunicationThread;


auto ResumeEduErrorCommunicationThread() -> void
auto ResumeEduCommunicationErrorThread() -> void
{
resumeEduErrorCommunicationThread.handle();
eduCommunicationErrorThread.resume();
RODOS::PRINTF("[EduCommunicationErrorThread] EduCommunicationErrorThread resumed\n");
}
}
2 changes: 1 addition & 1 deletion Sts1CobcSw/EduCommunicationErrorThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ namespace sts1cobcsw
extern std::int32_t eduCommunicationErrorCounter;


auto ResumeEduErrorCommunicationThread() -> void;
auto ResumeEduCommunicationErrorThread() -> void;
}
4 changes: 2 additions & 2 deletions Sts1CobcSw/EduListenerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class EduListenerThread : public StaticThread<>
// RODOS::PRINTF(
// "[EduListenerThread] Edu communication error after call to
// GetStatus().\n");
ResumeEduErrorCommunicationThread();
ResumeEduCommunicationErrorThread();
}
else
{
Expand Down Expand Up @@ -117,7 +117,7 @@ class EduListenerThread : public StaticThread<>
"[EduListenerThread] Communication error after call to "
"ReturnResult().\n");
*/
ResumeEduErrorCommunicationThread();
ResumeEduCommunicationErrorThread();
}
else
{
Expand Down
20 changes: 4 additions & 16 deletions Sts1CobcSw/EduProgramQueueThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class EduProgramQueueThread : public RODOS::StaticThread<stackSize>
RODOS::PRINTF("UpdateTime error code : %d\n", errorCode);
RODOS::PRINTF(
"[EduProgramQueueThread] Communication error after call to UpdateTime().\n");
ResumeEduErrorCommunicationThread();
ResumeEduCommunicationErrorThread();
}

auto startDelay2 = ComputeStartDelay();
Expand Down Expand Up @@ -143,7 +143,7 @@ class EduProgramQueueThread : public RODOS::StaticThread<stackSize>
RODOS::PRINTF(
"[EduProgramQueueThread] Communication error after call to "
"ExecuteProgram().\n");
ResumeEduErrorCommunicationThread();
ResumeEduCommunicationErrorThread();
}
else
{
Expand Down Expand Up @@ -179,21 +179,9 @@ auto ComputeStartDelay() -> std::int64_t
return startDelay;
}


// TODO: Think about whether this is the right way to declare, design, use, etc. this
class ResumeEduProgramQueueThreadEvent : public RODOS::TimeEvent
{
public:
auto handle() -> void override
{
eduProgramQueueThread.resume();
RODOS::PRINTF("EduProgramQueueThread resumed from me\n");
}
} resumeEduProgramQueueThreadEvent;


auto ResumeEduProgramQueueThread() -> void
{
resumeEduProgramQueueThreadEvent.handle();
eduProgramQueueThread.resume();
RODOS::PRINTF("[EduProgramQueueThread] EduProgramQueueThread resumed\n");
}
}
Loading