TaskManagerIO - Summary
TaskManagerIO provides scheduling, events and interrupt marshalling, all while remaining thread safe across a wide range of boards. By thread safe we mean that you can add tasks to task manager from another thread while it’s still running. However, the task manager itself will always run on one thread, making it easy for you to write code.
This library contains the original scheduling support class TaskManager that was previously built into IoAbstraction.
Getting started and scheduling things to be done
Task manager can schedule tasks to be done either now, or at some point in the future. Available in all versions of task manager.
- Task Manager scheduling guide
- Tutorial - programming an Arduino using tasks
- Timed blink example (packaged with IoAbstraction)
- Arduino library compatibility matrix and build time settings
- Read the reference documentation
- Go to the code repo on github
Marshalling interrupts to task manager tasks
Task Manager can add an interrupt on your behalf that is marshalled into a task execution. Available in all versions of task manager.
Polling, Interrupt based and multi-threaded events
TaskManagerIO has a complete eventing framework built into it, on top of this many types of event based programs can be built.
- Using polled events with TaskManager
- Using interrupt event with TaskManager
- Using spin-lock with TaskManager
Adding tasks from other threads
If you are using an RTOS such as FreeRTOS on ESP32 or mbed RTOS 6 you can safely add tasks and trigger events from other threads. However, you should never run the run loop from more than one thread at a time. You can however, start another task-manager on another thread.
Remember that one of TaskManagerIO’s main advantages is that your embedded apps don’t need to be concerned with the possibility of access across more than one thread, or working out how to handle raw interrupt handlers. Removing these from the mix allows code to be cleaner.