coroutine: kinda works now

This commit is contained in:
Kevin Hester
2020-10-10 09:57:57 +08:00
parent 4b9ea4f808
commit 49b4ed2a89
31 changed files with 392 additions and 150 deletions

View File

@@ -11,14 +11,14 @@ namespace concurrency
*/
class Periodic : public OSThread
{
uint32_t (*callback)();
int32_t (*callback)();
public:
// callback returns the period for the next callback invocation (or 0 if we should no longer be called)
Periodic(const char *name, uint32_t (*_callback)()) : OSThread(name), callback(_callback) {}
Periodic(const char *name, int32_t (*_callback)()) : OSThread(name), callback(_callback) {}
protected:
uint32_t runOnce() { return callback(); }
int32_t runOnce() { return callback(); }
};
} // namespace concurrency