38 void TimedSemaphore_Callback(Thread* pclOwner_,
void* pvData_)
43 auto* pclSemaphore =
static_cast<Semaphore*
>(pvData_);
46 pclOwner_->SetExpired(
true);
49 pclSemaphore->WakeMe(pclOwner_);
112 auto bThreadWake =
false;
156 auto clSemTimer =
Timer {};
157 auto bUseTimer =
false;
172 if (0u != u32WaitTimeMS_) {
175 clSemTimer.Start(
false, u32WaitTimeMS_, TimedSemaphore_Callback,
this);
202 return Pend_i(u32WaitTimeMS_);
uint8_t WakeNext()
Wake the next thread waiting on the semaphore. Used internally.
void UnBlock(Thread *pclThread_)
UnBlock Unblock a thread that is already blocked on this object, returning it to the "ready" state by...
void BlockPriority(Thread *pclThread_)
BlockPriority Same as Block(), but ensures that threads are added to the block-list in priority-order...
uint16_t m_u16MaxValue
Maximum count that can be held by this semaphore.
Mark3::Thread * g_pclCurrent
PORT_PRIO_TYPE GetCurPriority(void)
GetCurPriority Return the priority of the current thread.
bool Pend_i(uint32_t u32WaitTimeMS_)
Pend_i.
Single include file given to users of the Mark3 Kernel API.
The Thread Class. This object providing the fundamental thread control data structures and functions ...
void WakeMe(Thread *pclChosenOne_)
Wake a thread blocked on the semaphore. This is an internal function used for implementing timed sema...
void SetExpired(bool bExpired_)
SetExpired Set the status of the current blocking call on the thread.
bool IsInitialized(void)
IsInitialized.
static void Yield(void)
Yield Yield the thread - this forces the system to call the scheduler and determine what thread shoul...
#define PANIC_ACTIVE_SEMAPHORE_DESCOPED
The CriticalGuard class. This class provides an implemention of RAII for critical sections...
void Pend()
Decrement the semaphore count. If the count is zero, the calling Thread will block until the semaphor...
Thread * HighestWaiter()
HighestWaiter Return a pointer to the highest-priority thread in the thread-list. ...
bool GetExpired()
GetExpired Return the status of the most-recent blocking call on the thread.
The Timer Class. This class provides kernel-managed timers, used to provide high-precision delays...
uint16_t GetCount()
Return the current semaphore counter. This can be usedd by a thread to bypass blocking on a semaphore...
bool Post()
Increment the semaphore count. If the semaphore count is zero at the time this is called...
T * GetHead()
GetHead Get the head node in the linked list.
void Init(uint16_t u16InitVal_, uint16_t u16MaxVal_)
Initialize a semaphore before use. Must be called before attempting post/pend operations on the objec...
void SetInitialized(void)
SetInitialized.
static Thread * GetCurrentThread()
GetCurrentThread Return the pointer to the currently-running thread.
uint16_t m_u16Value
Current count held by the semaphore.
static void Panic(uint16_t u16Cause_)
Panic Cause the kernel to enter its panic state.