mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 01:32:40 +00:00
coroutine: wip
This commit is contained in:
@@ -1,17 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "FreeRtosThread.h"
|
||||
#include "PosixThread.h"
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Thread.h"
|
||||
#include "freertosinc.h"
|
||||
|
||||
namespace concurrency
|
||||
{
|
||||
|
||||
#ifdef HAS_FREE_RTOS
|
||||
typedef FreeRtosThread OSThread;
|
||||
#endif
|
||||
/**
|
||||
* @brief Base threading
|
||||
*
|
||||
* TODO FIXME @geeksville
|
||||
* basic functionality
|
||||
* sleeping the correct amount of time in main
|
||||
* NotifiedWorkerThread set/clears enabled
|
||||
*
|
||||
* stopping sleep instantly as soon as an event occurs.
|
||||
* use global functions delayTillWakeEvent(time), doWakeEvent(isInISR) - use freertos mutex or somesuch
|
||||
*
|
||||
* remove lock/lockguard
|
||||
*/
|
||||
class OSThread
|
||||
{
|
||||
public:
|
||||
virtual ~OSThread() {}
|
||||
|
||||
#ifdef __unix__
|
||||
typedef PosixThread OSThread;
|
||||
#endif
|
||||
// uint32_t getStackHighwaterMark() { return uxTaskGetStackHighWaterMark(taskHandle); }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The method that will be called each time our thread gets a chance to run
|
||||
*/
|
||||
virtual void runOnce() = 0;
|
||||
};
|
||||
|
||||
} // namespace concurrency
|
||||
|
||||
Reference in New Issue
Block a user