QP/C++  8.0.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QXSemaphore Class Reference

Counting Semaphore of the QXK preemptive kernel. More...

Detailed Description

Counting Semaphore of the QXK preemptive kernel.

Details
QP::QXSemaphore is a blocking mechanism intended primarily for signaling extended threads. The semaphore is initialized with the maximum count (see QXSemaphore::init()), which allows you to create a binary semaphore (when the maximum count is 1) and counting semaphore when the maximum count is > 1.
Usage
The following example illustrates how to instantiate and use the semaphore in your application.
QP::QXSemaphore TH_sema; // <===
. . .
void XThread2::run(QP::QXThread * const thr) {
TH_sema.init(0U, // count==0 (signaling semaphore)
1U); // max_count==1 (binary semaphore)
for (;;) {
// wait on a semaphore (BLOCK indefinitely)
TH_sema.wait();
. . .
}
}
Counting Semaphore of the QXK preemptive kernel.
eXtended (blocking) thread of the QXK preemptive kernel

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