coroutines: wip compiles but does not link

This commit is contained in:
Kevin Hester
2020-10-09 14:16:51 +08:00
parent 10f64590a9
commit 2044427e97
23 changed files with 132 additions and 299 deletions
+17 -6
View File
@@ -4,11 +4,13 @@
#include <stdint.h>
#include "Thread.h"
#include "freertosinc.h"
#include "ThreadController.h"
namespace concurrency
{
extern ThreadController mainController, timerController;
/**
* @brief Base threading
*
@@ -17,23 +19,32 @@ namespace concurrency
* sleeping the correct amount of time in main
* NotifiedWorkerThread set/clears enabled
*
* notifyLater should start now - not relative to last start time
* clear notification before calling handler
*
* stopping sleep instantly as soon as an event occurs.
* use global functions delayTillWakeEvent(time), doWakeEvent(isInISR) - use freertos mutex or somesuch
*
* have router thread block on its message queue in runOnce
*
* remove lock/lockguard
*/
class OSThread
class OSThread : public Thread
{
public:
virtual ~OSThread() {}
ThreadController *controller;
// uint32_t getStackHighwaterMark() { return uxTaskGetStackHighWaterMark(taskHandle); }
public:
OSThread(const char *name, uint32_t period = 0, ThreadController *controller = &mainController);
virtual ~OSThread();
protected:
/**
* The method that will be called each time our thread gets a chance to run
*
* Returns desired period for next invocation (or 0 for no change)
*/
virtual void runOnce() = 0;
virtual uint32_t runOnce() = 0;
};
} // namespace concurrency