ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Data Fields

Thread Struct Reference
[Threads]

Structure representing a thread. More...

#include <chthreads.h>

Inherits ThreadsQueue.

Collaboration diagram for Thread:
Collaboration graph
[legend]

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.
tstate_t p_state
 Current thread state.
tmode_t p_flags
 Various thread flags.
trefs_t p_refs
 References to this thread.
volatile systime_t p_time
 Thread consumed time in ticks.
union {
   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.
p_u
 State-specific fields.
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.

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 56 of file chthreads.h.


Field Documentation

Next in the list/queue.

Reimplemented from ThreadsQueue.

Definition at line 57 of file chthreads.h.

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

Previous in the queue.

Reimplemented from ThreadsQueue.

Definition at line 59 of file chthreads.h.

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

Processor context.

Definition at line 62 of file chthreads.h.

Newer registry element.

Definition at line 64 of file chthreads.h.

Referenced by chRegNextThread().

Older registry element.

Definition at line 65 of file chthreads.h.

Current thread state.

Definition at line 71 of file chthreads.h.

Referenced by chDbgTrace(), chEvtSignalI(), chMsgSend(), chMtxLockS(), chSchReadyI(), chSchWakeupS(), chThdResume(), chThdWait(), and init_thread().

Various thread flags.

Definition at line 75 of file chthreads.h.

Referenced by chThdCreateFromHeap(), chThdCreateFromMemoryPool(), chThdRelease(), chThdTerminate(), and init_thread().

References to this thread.

Definition at line 80 of file chthreads.h.

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

Thread consumed time in ticks.

Note:
This field can overflow.

Definition at line 93 of file chthreads.h.

Referenced by init_thread().

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 107 of file chthreads.h.

Referenced by chCondBroadcastI(), chCondSignalI(), chCondWaitS(), chEvtSignalI(), chMsgSend(), chSchWakeupS(), 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 114 of file chthreads.h.

Referenced by chThdExit(), 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 121 of file chthreads.h.

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

Enabled events mask.

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

Definition at line 128 of file chthreads.h.

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

union { ... } Thread::p_u

State-specific fields.

Note:
All the fields declared in this union are only valid in the specified state or condition and are thus volatile.

Referenced by chCondBroadcastI(), chCondSignalI(), chCondWaitS(), chDbgTrace(), chEvtSignalI(), chEvtWaitAll(), chEvtWaitAllTimeout(), chEvtWaitAny(), chEvtWaitAnyTimeout(), chEvtWaitOne(), chEvtWaitOneTimeout(), chMsgSend(), chMtxLockS(), chSchWakeupS(), chSemResetI(), chSemSignalI(), chSemSignalWait(), chThdExit(), and chThdWait().

Termination waiting list.

Definition at line 135 of file chthreads.h.

Referenced by chThdExit(), chThdWait(), and init_thread().

Messages queue.

Definition at line 141 of file chthreads.h.

Referenced by chMsgSend(), and init_thread().

Thread message.

Definition at line 145 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 158 of file chthreads.h.

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

Thread's own, non-inherited, priority.

Definition at line 162 of file chthreads.h.

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

Memory Pool where the thread workspace is returned.

Definition at line 168 of file chthreads.h.

Referenced by chThdCreateFromMemoryPool(), and chThdRelease().


Generated on Sun Oct 24 2010 09:40:49 for ChibiOS/RT by doxygen 1.7.1