ChibiOS/RT
2.5.1
Thread Struct Reference

Detailed Description

Structure representing a thread.

Note:
Not all the listed fields are always needed, by switching off some not needed ChibiOS/RT subsystems it is possible to save RAM space by shrinking the Thread structure.

Definition at line 87 of file chthreads.h.

#include <chthreads.h>

Inheritance diagram for Thread:
Collaboration diagram for Thread:

Data Fields

Threadp_next
 Next in the list/queue.
Threadp_prev
 Previous in the queue.
tprio_t p_prio
 Thread priority.
struct context p_ctx
 Processor context.
Threadp_newer
 Newer registry element.
Threadp_older
 Older registry element.
const char * p_name
 Thread name or NULL.
stkalign_tp_stklimit
 Thread stack boundary.
tstate_t p_state
 Current thread state.
tmode_t p_flags
 Various thread flags.
trefs_t p_refs
 References to this thread.
tslices_t p_preempt
 Number of ticks remaining to this thread.
volatile systime_t p_time
 Thread consumed time in ticks.
ThreadsList p_waiting
 Termination waiting list.
ThreadsQueue p_msgqueue
 Messages queue.
msg_t p_msg
 Thread message.
eventmask_t p_epending
 Pending events mask.
Mutexp_mtxlist
 List of the mutexes owned by this thread.
tprio_t p_realprio
 Thread's own, non-inherited, priority.
void * p_mpool
 Memory Pool where the thread workspace is returned.
msg_t rdymsg
 Thread wakeup code.
msg_t exitcode
 Thread exit code.
void * wtobjp
 Pointer to a generic "wait" object.
eventmask_t ewmask
 Enabled events mask.

Field Documentation

Next in the list/queue.

Reimplemented from ThreadsQueue.

Definition at line 88 of file chthreads.h.

Referenced by chSchDoRescheduleAhead(), chSchReadyI(), dequeue(), fifo_remove(), list_insert(), list_remove(), prio_insert(), and queue_insert().

Previous in the queue.

Reimplemented from ThreadsQueue.

Definition at line 90 of file chthreads.h.

Referenced by dequeue(), lifo_remove(), prio_insert(), and queue_insert().

Processor context.

Definition at line 93 of file chthreads.h.

Newer registry element.

Definition at line 95 of file chthreads.h.

Referenced by chRegNextThread().

Older registry element.

Definition at line 96 of file chthreads.h.

const char* Thread::p_name

Thread name or NULL.

Definition at line 103 of file chthreads.h.

Referenced by _thread_init().

Thread stack boundary.

Definition at line 109 of file chthreads.h.

Referenced by _thread_init().

References to this thread.

Definition at line 123 of file chthreads.h.

Referenced by _thread_init(), chRegFirstThread(), chRegNextThread(), chThdAddRef(), chThdRelease(), and chThdWait().

Number of ticks remaining to this thread.

Definition at line 129 of file chthreads.h.

Referenced by _thread_init(), chSchDoRescheduleBehind(), and chSchGoSleepS().

Thread consumed time in ticks.

Note:
This field can overflow.

Definition at line 136 of file chthreads.h.

Referenced by _thread_init().

Thread wakeup code.

Note:
This field contains the low level message sent to the thread by the waking thread or interrupt handler. The value is valid after exiting the chSchWakeupS() function.

Definition at line 150 of file chthreads.h.

Referenced by chCondBroadcastI(), chCondSignalI(), chCondWaitS(), chEvtSignalI(), chIQPutI(), chIQResetI(), chMsgSend(), chOQGetI(), chOQResetI(), chSchWakeupS(), chSemAddCounterI(), chSemResetI(), chSemSignalI(), and chSemSignalWait().

Thread exit code.

Note:
The thread termination code is stored in this field in order to be retrieved by the thread performing a chThdWait() on this thread.

Definition at line 157 of file chthreads.h.

Referenced by chThdExitS(), and chThdWait().

Pointer to a generic "wait" object.

Note:
This field is used to get a generic pointer to a synchronization object and is valid when the thread is in one of the wait states.

Definition at line 164 of file chthreads.h.

Referenced by chCondWaitS(), chMsgSend(), chMtxLockS(), chSemSignalWait(), and dbg_trace().

Enabled events mask.

Note:
This field is only valid while the thread is in the THD_STATE_WTOREVT or THD_STATE_WTANDEVT states.

Definition at line 171 of file chthreads.h.

Referenced by chEvtSignalI(), chEvtWaitAll(), chEvtWaitAllTimeout(), chEvtWaitAny(), chEvtWaitAnyTimeout(), chEvtWaitOne(), and chEvtWaitOneTimeout().

Termination waiting list.

Definition at line 178 of file chthreads.h.

Referenced by _thread_init(), chThdExitS(), and chThdWait().

Messages queue.

Definition at line 184 of file chthreads.h.

Referenced by _thread_init(), and chMsgSend().

Thread message.

Definition at line 188 of file chthreads.h.

Referenced by chMsgSend().

List of the mutexes owned by this thread.

Note:
The list is terminated by a NULL in this field.

Definition at line 201 of file chthreads.h.

Referenced by _thread_init(), chCondWaitS(), chMtxLockS(), chMtxUnlock(), chMtxUnlockAll(), and chMtxUnlockS().

Thread's own, non-inherited, priority.

Definition at line 205 of file chthreads.h.

Referenced by _thread_init(), chMtxUnlock(), chMtxUnlockAll(), and chMtxUnlockS().

Memory Pool where the thread workspace is returned.

Definition at line 211 of file chthreads.h.

Referenced by chThdCreateFromMemoryPool(), and chThdRelease().