FreeRTOS Addons
|
#include <workqueue.hpp>
Public Member Functions | |
WorkItem (bool freeAfterComplete=false) | |
virtual | ~WorkItem () |
bool | FreeAfterRun () |
virtual void | Run ()=0 |
This class encapsulates the idea of a discrete, non-repeating task. Create a WorkItem when there is something you need to do on a different Thread, but doesn't have to happen periodically. This is a great construct for one off fire and forget tasks.
This is an abstract base class. To use this, you need to subclass it. All of your WorkItems should be derived from this class. Then implement the virtual Run function. This is a similar design to Java threading.
WorkItem::WorkItem | ( | bool | freeAfterComplete = false | ) |
Our constructor.
freeAfterComplete | If you pass in a true, you are requesing the WorkQueue itself to delete this WorkItem after it has run it. |
|
virtual |
Our destructor.
bool WorkItem::FreeAfterRun | ( | ) |
Allows a client to decide if this WorkItem is marked for automatic deletion.
|
pure virtual |
Implementation of your actual WorkItem function. You must override this function.