|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Thread-safe queue of entries ordered by due time; entries become retrievable once their timestamp passes. More...
#include <Utils.h>
Public Member Functions | |
| TimeQueue () | |
| virtual | ~TimeQueue () |
| bool | add (uint64 time, T entry) |
| Insert an entry sorted by its due time. | |
| uint32 | getCount () |
| Number of scheduled entries. | |
| bool | getNextEntryDue (T &entry) |
| Pop the earliest entry if its due time has passed (non-blocking). | |
| virtual bool | clear () |
| Discard all scheduled entries. | |
Protected Attributes | |
| Mutex | mutex |
| std::list< TimeQueueEntry< T > > | internalList |
Thread-safe queue of entries ordered by due time; entries become retrievable once their timestamp passes.
| T | Element type (copied by value); see TimeQueuePointer for owned heap pointers. |
|
inline |
|
inlinevirtual |
|
inline |
Insert an entry sorted by its due time.
| time | Due time (ms, GetTimeNow() scale). |
| entry | Value to schedule. |
Definition at line 872 of file Utils.h.
References cmlabs::utils::TimeQueueEntry< T >::entry, internalList, mutex, and cmlabs::utils::TimeQueueEntry< T >::time.
|
inlinevirtual |
Discard all scheduled entries.
Reimplemented in cmlabs::utils::TimeQueuePointer< T >.
Definition at line 922 of file Utils.h.
References internalList, and mutex.
|
inline |
Number of scheduled entries.
Definition at line 893 of file Utils.h.
References internalList, and mutex.
|
inline |
Pop the earliest entry if its due time has passed (non-blocking).
| [out] | entry | Receives the due entry. |
Definition at line 903 of file Utils.h.
References cmlabs::utils::TimeQueueEntry< T >::entry, cmlabs::GetTimeNow(), internalList, mutex, and cmlabs::utils::TimeQueueEntry< T >::time.
Referenced by cmlabs::utils::TimeQueuePointer< T >::getNextEntryDue().
|
protected |
Definition at line 933 of file Utils.h.
Referenced by add(), clear(), cmlabs::utils::TimeQueuePointer< T >::clear(), getCount(), and getNextEntryDue().
|
protected |
Definition at line 932 of file Utils.h.
Referenced by add(), clear(), cmlabs::utils::TimeQueuePointer< T >::clear(), getCount(), and getNextEntryDue().