Add thread wrapper
Build / Build app and tests (ubuntu-24.04) (push) Failing after 2m32s
Documentation / Build (1.14.0) (push) Failing after 15s
Documentation / Build (1.9.6) (push) Successful in 12s
Documentation / Deploy (push) Has been skipped

This commit is contained in:
2026-04-23 21:37:09 -07:00
parent ae53d7f7f3
commit 7f17e56e34
8 changed files with 82 additions and 23 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef THREAD_WRAPPER_HPP
#define THREAD_WRAPPER_HPP
#include <cstddef>
namespace app {
template <typename ThreadType> class ThreadWrapper {
public:
/**
* @brief Entry point to thread. Must define init(), run(), and finalize() for
* thread type.
*
*/
inline static void entryPoint(void *, void *, void *) {
auto thread = ThreadType();
thread.init();
while (true) {
thread.run();
thread.incrementRunCount();
}
// NOTE: Maybe one day I'll add logic to be able to finalize a thread...
thread.finalize();
}
private:
inline void incrementRunCount() { ++runCounter_; }
std::size_t runCounter_ = 0;
};
} // namespace app
#endif