ChibiOS/RT Architecture - Reference Manual - Guides |
Threads macros and structures. More...
Go to the source code of this file.
Data Structures | |
struct | Thread |
Structure representing a thread. More... | |
Defines | |
#define | THD_STATE_READY 0 |
Thread state: Ready to run, waiting on the ready list. | |
#define | THD_STATE_CURRENT 1 |
Thread state: Currently running. | |
#define | THD_STATE_SUSPENDED 2 |
Thread state: Thread created in suspended state. | |
#define | THD_STATE_WTSEM 3 |
Thread state: Waiting on a semaphore. | |
#define | THD_STATE_WTMTX 4 |
Thread state: Waiting on a mutex. | |
#define | THD_STATE_WTCOND 5 |
Thread state: Waiting in chCondWait() . | |
#define | THD_STATE_SLEEPING 6 |
Thread state: Waiting in chThdSleep() or chThdSleepUntil() . | |
#define | THD_STATE_WTEXIT 7 |
Thread state: Waiting in chThdWait() . | |
#define | THD_STATE_WTOREVT 8 |
Thread state: Waiting in chEvtWaitXXX() . | |
#define | THD_STATE_WTANDEVT 9 |
Thread state: Waiting in chEvtWaitAllTimeout() . | |
#define | THD_STATE_SNDMSG 10 |
Thread state: Waiting in chMsgSend() . | |
#define | THD_STATE_WTMSG 11 |
Thread state: Waiting in chMsgWait() . | |
#define | THD_STATE_FINAL 12 |
Thread state: After termination. | |
#define | THD_MEM_MODE_MASK 3 |
Thread memory mode mask. | |
#define | THD_MEM_MODE_STATIC 0 |
Thread memory mode: static. | |
#define | THD_MEM_MODE_HEAP 1 |
Thread memory mode: heap. | |
#define | THD_MEM_MODE_MEMPOOL 2 |
Thread memory mode: pool. | |
#define | THD_TERMINATE 4 |
Termination requested. | |
#define | chThdSelf() currp |
Returns a pointer to the current Thread . | |
#define | chThdGetPriority() (currp->p_prio) |
Returns the current thread priority. | |
#define | chThdLS() (void *)(currp + 1) |
Returns the pointer to the Thread local storage area, if any. | |
#define | chThdTerminated(tp) ((tp)->p_state == THD_STATE_FINAL) |
Verifies if the specified thread is in the THD_STATE_FINAL state. | |
#define | chThdShouldTerminate() (currp->p_flags & THD_TERMINATE) |
Verifies if the current thread has a termination request pending. | |
#define | chThdResumeI(tp) chSchReadyI(tp) |
Resumes a thread created with chThdInit() . | |
#define | chThdSleepS(time) chSchGoSleepTimeoutS(THD_STATE_SLEEPING, time) |
Suspends the invoking thread for the specified time. | |
#define | chThdSleepSeconds(sec) chThdSleep(S2ST(sec)) |
Delays the invoking thread for the specified number of seconds. | |
#define | chThdSleepMilliseconds(msec) chThdSleep(MS2ST(msec)) |
Delays the invoking thread for the specified number of milliseconds. | |
#define | chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec)) |
Delays the invoking thread for the specified number of microseconds. | |
Typedefs | |
typedef msg_t(* | tfunc_t )(void *) |
Thread function. | |
Functions | |
Thread * | init_thread (Thread *tp, tprio_t prio) |
Initializes a thread structure. | |
Thread * | chThdCreateI (void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread into a static memory area. | |
Thread * | chThdCreateStatic (void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread into a static memory area. | |
Thread * | chThdCreateFromHeap (MemoryHeap *heapp, size_t size, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread allocating the memory from the heap. | |
Thread * | chThdCreateFromMemoryPool (MemoryPool *mp, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread allocating the memory from the specified memory pool. | |
tprio_t | chThdSetPriority (tprio_t newprio) |
Changes the running thread priority level then reschedules if necessary. | |
Thread * | chThdResume (Thread *tp) |
Resumes a suspended thread. | |
void | chThdTerminate (Thread *tp) |
Requests a thread termination. | |
void | chThdSleep (systime_t time) |
Suspends the invoking thread for the specified time. | |
void | chThdSleepUntil (systime_t time) |
Suspends the invoking thread until the system time arrives to the specified value. | |
void | chThdYield (void) |
Yields the time slot. | |
void | chThdExit (msg_t msg) |
Terminates the current thread by specifying an exit status code. | |
Thread * | chThdAddRef (Thread *tp) |
Adds a reference to a thread object. | |
void | chThdRelease (Thread *tp) |
Releases a reference to a thread object. | |
msg_t | chThdWait (Thread *tp) |
Blocks the execution of the invoking thread until the specified thread terminates then the exit code is returned. |
Threads macros and structures.
Definition in file chthreads.h.