The EventFlag class. This class implements a blocking object, similar to a semaphore or mutex, commonly used for synchronizing thread execution based on events occurring within the system. Each EventFlag object contains a 16-bit bitmask, which is used to trigger events on associated threads. Threads wishing to block, waiting for a specific event to occur can wait on any pattern within this 16-bit bitmask to be set. Here, we provide the ability for a thread to block, waiting for ANY bits in a specified mask to be set, or for ALL bits within a specific mask to be set. Depending on how the object is configured, the bits that triggered the wakeup can be automatically cleared once a match has occurred.
More...
#include <eventflag.h>
|
void * | operator new (size_t sz, void *pv) |
|
| ~EventFlag () |
|
void | Init () |
| Init Initializes the EventFlag object prior to use. More...
|
|
uint16_t | Wait (uint16_t u16Mask_, EventFlagOperation eMode_) |
| Wait Block a thread on the specific flags in this event flag group. More...
|
|
uint16_t | Wait (uint16_t u16Mask_, EventFlagOperation eMode_, uint32_t u32TimeMS_) |
| Wait Block a thread on the specific flags in this event flag group. More...
|
|
void | WakeMe (Thread *pclChosenOne_) |
| WakeMe Wake the given thread, currently blocking on this object. More...
|
|
void | Set (uint16_t u16Mask_) |
| Set Set additional flags in this object (logical OR). This API can potentially result in threads blocked on Wait() to be unblocked. More...
|
|
void | Clear (uint16_t u16Mask_) |
| ClearFlags - Clear a specific set of flags within this object, specific by bitmask. More...
|
|
uint16_t | GetMask () |
| GetMask Returns the state of the 16-bit bitmask within this object. More...
|
|
| BlockingObject () |
|
| ~BlockingObject () |
|
|
uint16_t | Wait_i (uint16_t u16Mask_, EventFlagOperation eMode_, uint32_t u32TimeMS_) |
| Wait_i Interal abstraction used to manage both timed and untimed wait operations. More...
|
|
|
void | Block (Thread *pclThread_) |
| Block Blocks a thread on this object. This is the fundamental operation performed by any sort of blocking operation in the operating system. All semaphores/mutexes/sleeping/messaging/etc ends up going through the blocking code at some point as part of the code that manages a transition from an "active" or "waiting" thread to a "blocked" thread. More...
|
|
void | BlockPriority (Thread *pclThread_) |
| BlockPriority Same as Block(), but ensures that threads are added to the block-list in priority-order, which optimizes the unblock procedure. More...
|
|
void | UnBlock (Thread *pclThread_) |
| UnBlock Unblock a thread that is already blocked on this object, returning it to the "ready" state by performing the following steps: More...
|
|
void | SetInitialized (void) |
| SetInitialized. More...
|
|
bool | IsInitialized (void) |
| IsInitialized. More...
|
|
ThreadList | m_clBlockList |
|
uint8_t | m_u8Initialized |
|
static constexpr auto | m_uBlockingInvalidCookie = uint8_t { 0x3C } |
|
static constexpr auto | m_uBlockingInitCookie = uint8_t { 0xC3 } |
|
The EventFlag class. This class implements a blocking object, similar to a semaphore or mutex, commonly used for synchronizing thread execution based on events occurring within the system. Each EventFlag object contains a 16-bit bitmask, which is used to trigger events on associated threads. Threads wishing to block, waiting for a specific event to occur can wait on any pattern within this 16-bit bitmask to be set. Here, we provide the ability for a thread to block, waiting for ANY bits in a specified mask to be set, or for ALL bits within a specific mask to be set. Depending on how the object is configured, the bits that triggered the wakeup can be automatically cleared once a match has occurred.
- Examples:
- lab7_events/main.cpp.
Definition at line 45 of file eventflag.h.
◆ ~EventFlag()
Mark3::EventFlag::~EventFlag |
( |
| ) |
|
◆ Clear()
void Mark3::EventFlag::Clear |
( |
uint16_t |
u16Mask_ | ) |
|
ClearFlags - Clear a specific set of flags within this object, specific by bitmask.
- Parameters
-
u16Mask_ | - Bitmask of flags to clear |
- Examples:
- lab7_events/main.cpp.
◆ GetMask()
uint16_t Mark3::EventFlag::GetMask |
( |
| ) |
|
GetMask Returns the state of the 16-bit bitmask within this object.
- Returns
- The state of the 16-bit bitmask
◆ Init()
void Mark3::EventFlag::Init |
( |
| ) |
|
Init Initializes the EventFlag object prior to use.
◆ operator new()
void* Mark3::EventFlag::operator new |
( |
size_t |
sz, |
|
|
void * |
pv |
|
) |
| |
|
inline |
◆ Set()
void Mark3::EventFlag::Set |
( |
uint16_t |
u16Mask_ | ) |
|
Set Set additional flags in this object (logical OR). This API can potentially result in threads blocked on Wait() to be unblocked.
- Parameters
-
u16Mask_ | - Bitmask of flags to set. |
- Examples:
- lab7_events/main.cpp.
◆ Wait() [1/2]
Wait Block a thread on the specific flags in this event flag group.
- Parameters
-
- Returns
- Bitmask condition that caused the thread to unblock, or 0 on error or timeout
- Examples:
- lab7_events/main.cpp.
◆ Wait() [2/2]
uint16_t Mark3::EventFlag::Wait |
( |
uint16_t |
u16Mask_, |
|
|
EventFlagOperation |
eMode_, |
|
|
uint32_t |
u32TimeMS_ |
|
) |
| |
Wait Block a thread on the specific flags in this event flag group.
- Parameters
-
- Returns
- Bitmask condition that caused the thread to unblock, or 0 on error or timeout
◆ Wait_i()
uint16_t Mark3::EventFlag::Wait_i |
( |
uint16_t |
u16Mask_, |
|
|
EventFlagOperation |
eMode_, |
|
|
uint32_t |
u32TimeMS_ |
|
) |
| |
|
private |
Wait_i Interal abstraction used to manage both timed and untimed wait operations.
- Parameters
-
- Returns
- Bitmask condition that caused the thread to unblock, or 0 on error or timeout
◆ WakeMe()
void Mark3::EventFlag::WakeMe |
( |
Thread * |
pclChosenOne_ | ) |
|
WakeMe Wake the given thread, currently blocking on this object.
- Parameters
-
pclChosenOne_ | Pointer to the owner thread to unblock. |
◆ m_u16SetMask
uint16_t Mark3::EventFlag::m_u16SetMask |
|
private |
Event flags currently set in this object.
Definition at line 119 of file eventflag.h.
The documentation for this class was generated from the following file:
- /mnt/c/Users/moslevin/m3-repo2/kernel/src/public/eventflag.h