QP/C  7.3.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QXThread Class Reference

eXtended (blocking) thread of the QXK preemptive kernel More...

#include "qxk.h"

Inheritance diagram for QXThread:
QActive QAsm

Public Member Functions

void QXThread_ctor (QXThread *const me, QXThreadHandler const handler, uint_fast8_t const tickRate)
 
bool QXThread_delay (QTimeEvtCtr const nTicks)
 
bool QXThread_delayCancel (QXThread *const me)
 
- Public Member Functions inherited from QActive
void QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2)
 

Static Public Member Functions

QEvt const * QXThread_queueGet (QTimeEvtCtr const nTicks)
 
- Static Public Member Functions inherited from QActive
void QActive_psInit (QSubscrList *const subscrSto, enum_t const maxSignal)
 

Public Attributes

QActive super
 
- Public Attributes inherited from QActive
QAsm super
 

Private Member Functions

void QXThread_block_ (QXThread const *const me)
 
void QXThread_unblock_ (QXThread const *const me)
 
void QXThread_timeout_ (QActive *const act)
 
void QXThread_teArm_ (QXThread *const me, enum_t const sig, QTimeEvtCtr const nTicks)
 
bool QXThread_teDisarm_ (QXThread *const me)
 
void QXThread_stackInit_ (QActive *const me, QXThreadHandler const handler, void *const stkSto, uint_fast16_t const stkSize)
 

Private Attributes

QTimeEvt timeEvt
 
QXThread const * QXThread_dummy
 

Additional Inherited Members

- Protected Member Functions inherited from QActive
void QActive_ctor (QActive *const me, QStateHandler const initial)
 
void QActive_stop (QActive *const me)
 
void QActive_subscribe (QActive const *const me, enum_t const sig)
 
void QActive_unsubscribe (QActive const *const me, enum_t const sig)
 
void QActive_unsubscribeAll (QActive const *const me)
 
bool QActive_defer (QActive const *const me, struct QEQueue *const eq, QEvt const *const e)
 
bool QActive_recall (QActive *const me, struct QEQueue *const eq)
 
uint_fast16_t QActive_flushDeferred (QActive const *const me, struct QEQueue *const eq)
 
- Protected Member Functions inherited from QAsm
void QAsm_ctor (QAsm *const me)
 
QState QHsm_top (QHsm const *const me, QEvt const *const e)
 
- Protected Attributes inherited from QAsm
struct QAsmVtable const * vptr
 
union QAsmAttr state
 
union QAsmAttr temp
 

Detailed Description

eXtended (blocking) thread of the QXK preemptive kernel

QXThread represents the eXtended (blocking) thread of the QXK kernel. Each extended thread in the application must be represented by the corresponding QXThread instance

Note
Typically, QXThread is instantiated directly in the application code. The customization of the thread occurs in the QXThread_ctor(), where you provide the thread-handler function as the parameter.
Usage
The following example illustrates how to instantiate and use an extended thread in your application.
#include "qpc.h"
QXThread blinky; // QXK extended-thread object
void main_blinky(QXThread * const me) { // thread function
while (1) {
BSP_ledOn();
QXThread_delay(100U); // BLOCK
BSP_ledOff();
QXThread_delay(200U); // BLOCK
}
}
int main() {
. . .
// initialize and start blinky thread
QXThread_ctor(&blinky, &main_blinky, 0);
static uint64_t stack_blinky[40]; // stack for the thread
QXTHREAD_START(&blinky,
5U, // priority
(void *)0, 0, // event queue (not used)
stack_blinky, sizeof(stack_blinky), // stack
(void *)0); // extra parameter (not used)
. . .
return QF_run(); // run the application */
}
QP/C interface including the backwards-compatibility layer.
int_t QF_run(void)
Definition qutest.c:189
#define QXTHREAD_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_)
Definition qxk.h:273
eXtended (blocking) thread of the QXK preemptive kernel
Definition qxk.h:145
bool QXThread_delay(QTimeEvtCtr const nTicks)
Definition qxk_xthr.c:92
void QXThread_ctor(QXThread *const me, QXThreadHandler const handler, uint_fast8_t const tickRate)

Definition at line 145 of file qxk.h.

Member Function Documentation

◆ QXThread_ctor()

void QXThread_ctor ( QXThread *const  me,
QXThreadHandler const  handler,
uint_fast8_t const  tickRate 
)

◆ QXThread_delay()

bool QXThread_delay ( QTimeEvtCtr const  nTicks)

Definition at line 92 of file qxk_xthr.c.

◆ QXThread_delayCancel()

bool QXThread_delayCancel ( QXThread *const  me)

Definition at line 140 of file qxk_xthr.c.

◆ QXThread_queueGet()

QEvt const * QXThread_queueGet ( QTimeEvtCtr const  nTicks)
static

Definition at line 161 of file qxk_xthr.c.

◆ QXThread_block_()

void QXThread_block_ ( QXThread const *const  me)
private

Definition at line 259 of file qxk_xthr.c.

◆ QXThread_unblock_()

void QXThread_unblock_ ( QXThread const *const  me)
private

Definition at line 275 of file qxk_xthr.c.

◆ QXThread_timeout_()

void QXThread_timeout_ ( QActive *const  act)
private

Definition at line 292 of file qxk_xthr.c.

◆ QXThread_teArm_()

void QXThread_teArm_ ( QXThread *const  me,
enum_t const  sig,
QTimeEvtCtr const  nTicks 
)
private

Definition at line 305 of file qxk_xthr.c.

◆ QXThread_teDisarm_()

bool QXThread_teDisarm_ ( QXThread *const  me)
private

Definition at line 349 of file qxk_xthr.c.

◆ QXThread_stackInit_()

void QXThread_stackInit_ ( QActive *const  me,
QXThreadHandler const  handler,
void *const  stkSto,
uint_fast16_t const  stkSize 
)
private

Member Data Documentation

◆ super

QActive QXThread::super

Definition at line 147 of file qxk.h.

◆ timeEvt

QXThread::timeEvt
private

property Time event to handle blocking timeouts

Definition at line 152 of file qxk.h.

◆ QXThread_dummy

QXThread::QXThread_dummy
private

dummy static member to force QM to generate 'struct QXThread'

property Dummy static member to force QM to generate "struct QXThread"

Definition at line 157 of file qxk.h.


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