![]() |
SuperTinyKernel™ RTOS 1.06.0
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Concrete implementation of IWaitObject, embedded in each KernelTask slot. More...
#include <stk.h>
Classes | |
| class | WaitRequest |
| Payload stored in the sync object's kernel-side list entry while a task is waiting. More... | |
Public Types | |
| typedef DLHeadType | ListHeadType |
| List head type for IWaitObject elements. | |
| typedef DLEntryType | ListEntryType |
| List entry type of IWaitObject elements. | |
| typedef DListEntry< IWaitObject, _ClosedLoop > | DLEntryType |
| Convenience alias for this entry type. Used to avoid repeating the full template spelling. | |
| typedef DListHead< IWaitObject, _ClosedLoop > | DLHeadType |
| Convenience alias for the corresponding list head type. | |
Public Member Functions | |
| WaitObject () | |
| ~WaitObject () | |
| Destructor. | |
| TId | GetTid () const |
| Get the TId of the task that owns this wait object. | |
| bool | IsTimeout () const |
| Check whether the wait expired due to timeout. | |
| bool | IsWaiting () const |
| Check if busy with waiting. | |
| void | Wake (bool timeout) |
| Wake the waiting task (called by ISyncObject when it signals). | |
| bool | Tick (Timeout elapsed_ticks) |
| Advance the timeout countdown by one tick. | |
| void | SetupWait (ISyncObject *sync_obj, Timeout timeout) |
| Configure and arm this wait object for a new wait operation. | |
| DLHeadType * | GetHead () const |
| Get the list head this entry currently belongs to. | |
| DLEntryType * | GetNext () const |
| Get the next entry in the list. | |
| DLEntryType * | GetPrev () const |
| Get the previous entry in the list. | |
| bool | IsLinked () const |
| Check whether this entry is currently a member of any list. | |
| operator IWaitObject * () | |
| Implicit conversion to a mutable pointer to the host object (T). | |
| operator const IWaitObject * () const | |
| Implicit conversion to a const pointer to the host object (T). | |
Public Attributes | |
| KernelTask * | m_task |
| Back-pointer to the owning KernelTask. Set once at construction; never changes. | |
| ISyncObject * | m_sync_obj |
Sync object this wait is registered with, or NULL when not waiting. | |
| volatile bool | m_timeout |
true if the wait expired due to timeout rather than a Wake() signal. | |
| Timeout | m_time_wait |
| Ticks remaining until timeout. Decremented each tick; WAIT_INFINITE means no timeout. | |
Private Member Functions | |
| void | Link (DLHeadType *head, DLEntryType *next, DLEntryType *prev) |
| Wire this entry into a list between prev and next. | |
| void | Unlink () |
| Remove this entry from its current list. | |
Private Attributes | |
| DLHeadType * | m_head |
Owning list head, or NULL when the entry is not linked. | |
| DLEntryType * | m_next |
Next entry in the list, or NULL (open list boundary) / first entry (closed loop). | |
| DLEntryType * | m_prev |
Previous entry in the list, or NULL (open list boundary) / last entry (closed loop). | |
Concrete implementation of IWaitObject, embedded in each KernelTask slot.
|
inherited |
Convenience alias for this entry type. Used to avoid repeating the full template spelling.
Definition at line 70 of file stk_linked_list.h.
|
inherited |
Convenience alias for the corresponding list head type.
Definition at line 75 of file stk_linked_list.h.
|
inherited |
List entry type of IWaitObject elements.
Definition at line 280 of file stk_common.h.
|
inherited |
List head type for IWaitObject elements.
Definition at line 275 of file stk_common.h.
|
inlineexplicit |
Definition at line 346 of file stk.h.
References m_sync_obj, m_task, m_time_wait, and m_timeout.
|
inline |
|
inlineinherited |
Get the list head this entry currently belongs to.
NULL if the entry is not linked. Definition at line 80 of file stk_linked_list.h.
|
inlineinherited |
Get the next entry in the list.
NULL if this is the last entry (open list) or the first entry (closed loop, where next wraps to first). _ClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 88 of file stk_linked_list.h.
|
inlineinherited |
Get the previous entry in the list.
NULL if this is the first entry (open list) or the last entry (closed loop, where prev wraps to last). _ClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 96 of file stk_linked_list.h.
|
inlinevirtual |
|
inlineinherited |
Check whether this entry is currently a member of any list.
true if linked (m_head != NULL); false otherwise. Definition at line 101 of file stk_linked_list.h.
|
inlinevirtual |
|
inline |
Check if busy with waiting.
true if waiting, false if not. Definition at line 378 of file stk.h.
References m_sync_obj.
Referenced by SetupWait(), and Wake().
|
inlineprivateinherited |
Wire this entry into a list between prev and next.
| [in] | head | The owning DListHead. Stored as a back-pointer for IsLinked() and ownership checks. |
| [in] | next | The entry that will follow this one, or NULL if this becomes the last entry. |
| [in] | prev | The entry that will precede this one, or NULL if this becomes the first entry. |
Definition at line 137 of file stk_linked_list.h.
|
inlineinherited |
Implicit conversion to a const pointer to the host object (T).
Definition at line 115 of file stk_linked_list.h.
|
inlineinherited |
Implicit conversion to a mutable pointer to the host object (T).
Definition at line 108 of file stk_linked_list.h.
|
inline |
Configure and arm this wait object for a new wait operation.
| [in] | sync_obj | The synchronization object to wait on. Must not already have this wait object registered (asserted). |
| [in] | timeout | Maximum ticks to wait, or WAIT_INFINITE for no timeout. |
Definition at line 424 of file stk.h.
References stk::ISyncObject::AddWaitObject(), IsWaiting(), m_sync_obj, m_time_wait, m_timeout, and STK_ASSERT.
|
inlinevirtual |
Advance the timeout countdown by one tick.
true if the wait is still active (not yet timed out), false if the timeout just expired (caller should stop ticking this object). true. Implements stk::IWaitObject.
Definition at line 404 of file stk.h.
References m_time_wait, m_timeout, and stk::WAIT_INFINITE.
|
inlineprivateinherited |
Remove this entry from its current list.
Definition at line 157 of file stk_linked_list.h.
|
inlinevirtual |
Wake the waiting task (called by ISyncObject when it signals).
| [in] | timeout | true if woken because the timeout expired, false if signalled. |
Implements stk::IWaitObject.
Definition at line 385 of file stk.h.
References IsWaiting(), m_sync_obj, m_task, m_time_wait, m_timeout, and STK_ASSERT.
|
privateinherited |
Owning list head, or NULL when the entry is not linked.
Definition at line 170 of file stk_linked_list.h.
|
privateinherited |
Next entry in the list, or NULL (open list boundary) / first entry (closed loop).
Definition at line 171 of file stk_linked_list.h.
|
privateinherited |
Previous entry in the list, or NULL (open list boundary) / last entry (closed loop).
Definition at line 172 of file stk_linked_list.h.
| ISyncObject* stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::m_sync_obj |
Sync object this wait is registered with, or NULL when not waiting.
Definition at line 436 of file stk.h.
Referenced by IsWaiting(), SetupWait(), WaitObject(), and Wake().
| KernelTask* stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::m_task |
Back-pointer to the owning KernelTask. Set once at construction; never changes.
Definition at line 435 of file stk.h.
Referenced by GetTid(), WaitObject(), and Wake().
| Timeout stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::m_time_wait |
Ticks remaining until timeout. Decremented each tick; WAIT_INFINITE means no timeout.
Definition at line 438 of file stk.h.
Referenced by SetupWait(), Tick(), WaitObject(), and Wake().
| volatile bool stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::m_timeout |
true if the wait expired due to timeout rather than a Wake() signal.
Definition at line 437 of file stk.h.
Referenced by IsTimeout(), SetupWait(), Tick(), WaitObject(), and Wake().