82#if (CH_CFG_SMP_MODE != FALSE) || defined(__DOXYGEN__)
105#define __THREADS_QUEUE_DATA(name) {__CH_QUEUE_DATA(name)}
114#define THREADS_QUEUE_DECL(name) \
115 threads_queue_t name = __THREADS_QUEUE_DATA(name)
130#define THD_WORKING_AREA_SIZE(n) \
131 MEM_ALIGN_NEXT(sizeof(thread_t) + PORT_WA_SIZE(n), PORT_STACK_ALIGN)
143#define THD_WORKING_AREA(s, n) PORT_WORKING_AREA(s, n)
150#define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))
157#define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) + \
158 (sizeof (s) / sizeof (stkalign_t)))
170#define THD_FUNCTION(tname, arg) PORT_THD_FUNCTION(tname, arg)
177#if (CH_CFG_SMP_MODE != FALSE) || defined(__DOXYGEN__)
188#define THD_DESCRIPTOR(name, wbase, wend, prio, funcp, arg) { \
198#define THD_DESCRIPTOR(name, wbase, wend, prio, funcp, arg) { \
219#define THD_DESCRIPTOR_AFFINITY(name, wbase, wend, prio, funcp, arg, oip) { \
247#define chThdSleepSeconds(sec) chThdSleep(TIME_S2I(sec))
263#define chThdSleepMilliseconds(msec) chThdSleep(TIME_MS2I(msec))
279#define chThdSleepMicroseconds(usec) chThdSleep(TIME_US2I(usec))
293#if CH_DBG_FILL_THREADS == TRUE
303#if CH_CFG_USE_REGISTRY == TRUE
309#if CH_CFG_USE_WAITEXIT == TRUE
369#if (CH_DBG_THREADS_PROFILING == TRUE) || defined(__DOXYGEN__)
376#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) || \
#define chThdQueueIsEmptyI(tqp)
Evaluates to true if the specified queue is empty.
#define chThdQueueObjectInit(tqp)
Initializes a threads queue object.
#define chThdResumeS(trp, msg)
Wakes up a thread waiting on a thread reference object.
#define chThdSleepS(timeout)
Suspends the invoking thread for the specified time.
#define chDbgAssert(c, r)
Condition assertion.
#define chDbgCheck(c)
Function parameters check.
#define chDbgCheckClassI()
static void ch_queue_init(ch_queue_t *qp)
Queue initialization.
static bool ch_queue_notempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is not empty.
static bool ch_queue_isempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is empty.
static ch_queue_t * ch_queue_fifo_remove(ch_queue_t *qp)
Removes the first-out element from a queue and returns it.
#define threadref(p)
Safe cast of a queue pointer to a thread pointer.
struct ch_os_instance os_instance_t
Type of an OS instance structure.
thread_t * thread_reference_t
Type of a thread reference.
port_stkalign_t stkalign_t
struct ch_thread thread_t
Type of a thread structure.
#define CH_STATE_FINAL
Thread terminated.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
#define __sch_get_currthread()
Current thread pointer get macro.
#define CH_STATE_QUEUED
On a queue.
#define CH_STATE_WTSTART
Just created.
#define CH_FLAG_TERMINATE
Termination requested flag.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
#define CH_STATE_SLEEPING
Sleeping.
void chThdExitS(msg_t msg)
Terminates the current thread.
msg_t chThdEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout)
Enqueues the caller thread on a threads queue object.
static thread_t * chThdGetSelfX(void)
Returns a pointer to the current thread_t.
static systime_t chThdGetTicksX(thread_t *tp)
Returns the number of ticks consumed by the specified thread.
thread_t * chThdCreateSuspended(const thread_descriptor_t *tdp)
Creates a new thread.
void(* tfunc_t)(void *p)
Thread function.
void chThdExit(msg_t msg)
Terminates the current thread.
msg_t chThdWait(thread_t *tp)
Blocks the execution of the invoking thread until the specified thread terminates then the exit code ...
void chThdResume(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
msg_t chThdSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
Sends the current thread sleeping and sets a reference variable.
thread_t * __thd_object_init(os_instance_t *oip, thread_t *tp, const char *name, tprio_t prio)
Initializes a thread structure.
thread_t * chThdCreateI(const thread_descriptor_t *tdp)
Creates a new thread.
void chThdResumeI(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
tprio_t chThdSetPriority(tprio_t newprio)
Changes the running thread priority level then reschedules if necessary.
static void chThdDoDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object.
static thread_t * chThdStartI(thread_t *tp)
Resumes a thread created with chThdCreateI().
void __thd_stackfill(uint8_t *startp, uint8_t *endp)
Stack fill utility.
void chThdSleep(sysinterval_t time)
Suspends the invoking thread for the specified time.
msg_t chThdSuspendS(thread_reference_t *trp)
Sends the current thread sleeping and sets a reference variable.
void chThdRelease(thread_t *tp)
Releases a reference to a thread object.
thread_t * chThdAddRef(thread_t *tp)
Adds a reference to a thread object.
void chThdTerminate(thread_t *tp)
Requests a thread termination.
thread_t * chThdStart(thread_t *tp)
Starts a thread created with chThdCreateSuspended().
void chThdSleepUntil(systime_t time)
Suspends the invoking thread until the system time arrives to the specified value.
static bool chThdTerminatedX(thread_t *tp)
Verifies if the specified thread is in the CH_STATE_FINAL state.
static tprio_t chThdGetPriorityX(void)
Returns the current thread priority.
void chThdDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object, if any.
thread_t * chThdCreateStatic(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg)
Creates a new thread.
void chThdYield(void)
Yields the time slot.
static stkalign_t * chThdGetWorkingAreaX(thread_t *tp)
Returns the working area base of the specified thread.
static bool chThdShouldTerminateX(void)
Verifies if the current thread has a termination request pending.
thread_t * chThdCreate(const thread_descriptor_t *tdp)
Creates a new thread.
systime_t chThdSleepUntilWindowed(systime_t prev, systime_t next)
Suspends the invoking thread until the system time arrives to the specified value.
thread_t * chThdCreateSuspendedI(const thread_descriptor_t *tdp)
Creates a new thread.
void chThdDequeueAllI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up all threads from the threads queue object.
uint64_t systime_t
Type of system time.
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification.
uint64_t sysinterval_t
Type of time interval.
tprio_t prio
Priority of this element.
union ch_thread::@065317322233202114332352372014266163076165303275 hdr
Shared list headers.
msg_t rdymsg
Thread wakeup code.
stkalign_t * wabase
Working area base address.
tstate_t state
Current thread state.
volatile systime_t time
Thread consumed time in ticks.
ch_priority_queue_t pqueue
Threads ordered queues element.
union ch_thread::@250330312022121344252011223135034045240103044261 u
State-specific fields.
tmode_t flags
Various thread flags.
Type of a thread descriptor.
stkalign_t * wbase
Pointer to the working area base.
const char * name
Thread name.
stkalign_t * wend
Pointer to the working area end.
void * arg
Thread argument.
tprio_t prio
Thread priority.
tfunc_t funcp
Thread function pointer.
os_instance_t * instance
OS instance affinity or NULL for current one.