mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-21 18:52:36 +10:00
coroutines: wip compiles but does not link
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user