QP/C++  7.3.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QP::QK Namespace Reference

preemptive, non-blocking kernel More...

Functions

QSchedStatus schedLock (std::uint_fast8_t const ceiling) noexcept
 
void schedUnlock (QSchedStatus const stat) noexcept
 
void onIdle ()
 

Detailed Description

preemptive, non-blocking kernel

Function Documentation

◆ schedLock()

QSchedStatus QP::QK::schedLock ( std::uint_fast8_t const  ceiling)
noexcept

QK selective scheduler lock

This function locks the QK scheduler to the specified ceiling.

Parameters
[in]ceilingpreemption ceiling to which the QK scheduler needs to be locked
Returns
The previous QK Scheduler lock status, which is to be used to unlock the scheduler by restoring its previous lock status in QK_schedUnlock().
Precondition qk:100
  • The QK scheduler lock cannot be called from an ISR
Note
QK::schedLock() must be always followed by the corresponding QK_schedUnlock().
See also
QK::schedUnlock()
Usage
The following example shows how to lock and unlock the QK scheduler:
std::uint32_t BSP::random() {
QP::QSchedStatus lockStat = QP::QK::schedLock(N_PHILO); // <== lock
std::uint32_rnd;
. . . // access/manipulate the shared random seed resource
return rnd;
}
QSchedStatus schedLock(std::uint_fast8_t const ceiling) noexcept
Definition qk.cpp:76
void schedUnlock(QSchedStatus const stat) noexcept
Definition qk.cpp:112
std::uint_fast16_t QSchedStatus
Definition qk.hpp:50

Definition at line 76 of file qk.cpp.

◆ schedUnlock()

void QP::QK::schedUnlock ( QSchedStatus const  stat)
noexcept

QK selective scheduler unlock

This function unlocks the QK scheduler to the previous status.

Parameters
[in]statprevious QK Scheduler lock status returned from QK_schedLock()
Precondition qk:200
  • the QK scheduler cannot be unlocked: from the ISR context
  • the current lock ceiling must be greater than the previous
Note
QK_schedUnlock() must always follow the corresponding QK_schedLock().
See also
QK_schedLock()
Usage
The following example shows how to lock and unlock the QK scheduler:
std::uint32_t BSP::random() {
QP::QSchedStatus lockStat = QP::QK::schedLock(N_PHILO);
std::uint32_rnd;
. . . // access/manipulate the shared random seed resource
QP::QK::schedUnlock(lockStat); // <=== unlock
return rnd;
}

Definition at line 112 of file qk.cpp.

◆ onIdle()

QP::QK::onIdle ( )

QK idle callback (customized in BSPs for QK)

QK::onIdle() is called continuously by the QK idle loop. This callback gives the application an opportunity to enter a power-saving CPU mode, or perform some other idle processing.

Note
QK::onIdle() is invoked with interrupts enabled and must also return with interrupts enabled.