yuriykulikov / Abandoned-Event-driven_Framework_for_Embedded_Systems

Abandoned, C++ did not work out so well. See pure C implementation here - https://github.com/yuriykulikov/EventDrivenEmbeddedFramework
21 stars 6 forks source link

Add simple cooperative scheduler #3

Open yuriykulikov opened 11 years ago

yuriykulikov commented 11 years ago

Goal is to schedule threads cooperatively, which will allow to maintain compatability of single and multithreaded code (at least partially). To implement this, threads should contain a short body, which does not block in single-threaded environment. It will be something like blocking on an queue with a 0 timeout - body immediately returns if it has nothing to do.

yuriykulikov commented 11 years ago

This does not seem realistic. As an alternative I would consider a one thread looper. All blocking threads can be replaced by interrupt handling routines. It means that common lines interpreter will work in the isr thread, which is not so good, but should be okay for small controllers like attiny. For everything else just use freertos.