|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Time-binned activation queue used by a PsySpace to drive time-triggered modules. More...
#include <PsySpace.h>
Public Member Functions | |
| TimeQueue () | |
| Create an empty time queue with its own timer. | |
| ~TimeQueue () | |
| Destroy the queue and delete all remaining schedules (owned by the queue). | |
| bool | addSchedule (TimeQueueSchedule *schedule) |
| Add a schedule to the queue. | |
| bool | removeSchedule (uint32 id) |
| Remove (and delete) a schedule by id. | |
| DataMessage * | waitForNextEvent (uint32 ms) |
| Block until the next scheduled event is due, or the timeout expires. | |
Time-binned activation queue used by a PsySpace to drive time-triggered modules.
Holds a collection of TimeQueueSchedule entries and hands out activation messages in temporal order. A space thread blocks in waitForNextEvent() and dispatches the resulting DataMessage to the scheduled component. Thread-safe: internal mutex protects the schedule map; a semaphore wakes waiters when schedules change.
Definition at line 91 of file PsySpace.h.
| cmlabs::TimeQueue::TimeQueue | ( | ) |
Create an empty time queue with its own timer.
Definition at line 23 of file PsySpace.cpp.
| cmlabs::TimeQueue::~TimeQueue | ( | ) |
Destroy the queue and delete all remaining schedules (owned by the queue).
Definition at line 27 of file PsySpace.cpp.
| bool cmlabs::TimeQueue::addSchedule | ( | TimeQueueSchedule * | schedule | ) |
Add a schedule to the queue.
| schedule | Schedule to add; ownership transfers to the TimeQueue. |
Definition at line 36 of file PsySpace.cpp.
References cmlabs::TimeQueueSchedule::end, cmlabs::TimeQueueSchedule::id, cmlabs::TimeQueueSchedule::interval, and cmlabs::TimeQueueSchedule::start.
| bool cmlabs::TimeQueue::removeSchedule | ( | uint32 | id | ) |
Remove (and delete) a schedule by id.
| id | Id of the schedule (TimeQueueSchedule::id). |
Definition at line 47 of file PsySpace.cpp.
Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_TimeQueue_1removeSchedule().
| DataMessage * cmlabs::TimeQueue::waitForNextEvent | ( | uint32 | ms | ) |
Block until the next scheduled event is due, or the timeout expires.
| ms | Maximum time to wait, in milliseconds. |
Definition at line 61 of file PsySpace.cpp.
References cmlabs::TimeQueueSchedule::msgTag, cmlabs::TimeQueueSchedule::msgType, and cmlabs::DataMessage::setTag().