Mark3 Realtime Kernel
Mark3::BlockingObject Class Reference

The BlockingObject class. Class implementing thread-blocking primatives. used for implementing things like semaphores, mutexes, message queues, or anything else that could cause a thread to suspend execution on some external stimulus. More...

#include <blocking.h>

Inheritance diagram for Mark3::BlockingObject:
Mark3::EventFlag Mark3::Mutex Mark3::Notify Mark3::Semaphore

Public Member Functions

 BlockingObject ()
 
 ~BlockingObject ()
 

Protected Member Functions

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...
 

Protected Attributes

ThreadList m_clBlockList
 
uint8_t m_u8Initialized
 

Static Protected Attributes

static constexpr auto m_uBlockingInvalidCookie = uint8_t { 0x3C }
 
static constexpr auto m_uBlockingInitCookie = uint8_t { 0xC3 }
 

Detailed Description

The BlockingObject class. Class implementing thread-blocking primatives. used for implementing things like semaphores, mutexes, message queues, or anything else that could cause a thread to suspend execution on some external stimulus.

Definition at line 65 of file blocking.h.

Constructor & Destructor Documentation

◆ BlockingObject()

Mark3::BlockingObject::BlockingObject ( )
inline

Definition at line 68 of file blocking.h.

◆ ~BlockingObject()

Mark3::BlockingObject::~BlockingObject ( )
inline

Definition at line 69 of file blocking.h.

Member Function Documentation

◆ Block()

void Mark3::BlockingObject::Block ( Thread pclThread_)
protected

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.

The steps involved in blocking a thread (which are performed in the function itself) are as follows;

1) Remove the specified thread from the current owner's list (which is likely one of the scheduler's thread lists) 2) Add the thread to this object's thread list 3) Setting the thread's "current thread-list" point to reference this object's threadlist.

Parameters
pclThread_Pointer to the thread object that will be blocked.

Definition at line 26 of file blocking.cpp.

◆ BlockPriority()

void Mark3::BlockingObject::BlockPriority ( Thread pclThread_)
protected

BlockPriority Same as Block(), but ensures that threads are added to the block-list in priority-order, which optimizes the unblock procedure.

Parameters
pclThread_Pointer to the Thread to Block.

Definition at line 41 of file blocking.cpp.

◆ IsInitialized()

bool Mark3::BlockingObject::IsInitialized ( void  )
inlineprotected

IsInitialized.

Returns
true if initialized, false if object uninitialized

Definition at line 123 of file blocking.h.

◆ SetInitialized()

void Mark3::BlockingObject::SetInitialized ( void  )
inlineprotected

SetInitialized.

Definition at line 117 of file blocking.h.

◆ UnBlock()

void Mark3::BlockingObject::UnBlock ( Thread pclThread_)
protected

UnBlock Unblock a thread that is already blocked on this object, returning it to the "ready" state by performing the following steps:

Parameters
pclThread_Pointer to the thread to unblock.

1) Removing the thread from this object's threadlist 2) Restoring the thread to its "original" owner's list

Definition at line 56 of file blocking.cpp.

Member Data Documentation

◆ m_clBlockList

ThreadList Mark3::BlockingObject::m_clBlockList
protected

ThreadList which is used to hold the list of threads blocked on a given object.

Definition at line 133 of file blocking.h.

◆ m_u8Initialized

uint8_t Mark3::BlockingObject::m_u8Initialized
protected

Token used to check whether or not the object has been initialized prior to use.

Definition at line 139 of file blocking.h.

◆ m_uBlockingInitCookie

constexpr auto Mark3::BlockingObject::m_uBlockingInitCookie = uint8_t { 0xC3 }
staticprotected

Definition at line 127 of file blocking.h.

◆ m_uBlockingInvalidCookie

constexpr auto Mark3::BlockingObject::m_uBlockingInvalidCookie = uint8_t { 0x3C }
staticprotected

Definition at line 126 of file blocking.h.


The documentation for this class was generated from the following files: