Go to the documentation of this file.
142 #if CH_CFG_TIME_QUANTUM > 0
203 #if CH_CFG_USE_SEMAPHORES == TRUE
210 #if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE)
235 #if (CH_CFG_OPTIMIZE_SPEED == FALSE) || defined(__DOXYGEN__)
251 }
while ((cp != qp) &&
281 #if CH_CFG_SMP_MODE == TRUE
312 otp->
state = newstate;
314 #if CH_CFG_TIME_QUANTUM > 0
363 chVTDoSetI(&vt, timeout, __sch_wakeup, (
void *)tp);
401 "priority order violation");
407 #if CH_CFG_SMP_MODE == TRUE
408 if (ntp->
owner != oip) {
467 #if !defined(CH_SCH_IS_PREEMPTION_REQUIRED_HOOKED)
488 #if CH_CFG_TIME_QUANTUM > 0
502 #if !defined(CH_SCH_DO_PREEMPTION_HOOKED)
528 #if CH_CFG_TIME_QUANTUM > 0
556 #if !defined(CH_SCH_PREEMPTION_HOOKED)
572 #if CH_CFG_TIME_QUANTUM > 0
#define CH_CFG_IDLE_LEAVE_HOOK()
Idle thread leave hook.
#define IDLEPRIO
Idle priority.
#define __instance_set_currthread(oip, tp)
Current thread pointer set macro.
thread_reference_t * wttrp
Pointer to a generic thread reference object.
#define CH_STATE_READY
Waiting on the ready list.
ch_queue_t * next
Next in the list/queue.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
static void __sch_reschedule_ahead(void)
Switches to the first thread on the runnable queue.
ch_priority_queue_t pqueue
Threads ordered queues element.
#define chSemFastSignalI(sp)
Increases the semaphore counter.
#define currcore
Access to current core's instance structure.
msg_t rdymsg
Thread wakeup code.
#define CH_CFG_TIME_QUANTUM
Round robin interval.
static bool chVTIsArmedI(const virtual_timer_t *vtp)
Returns true if the specified timer is armed.
#define chSysUnlockFromISR()
Leaves the kernel lock state from within an interrupt handler.
#define chDbgAssert(c, r)
Condition assertion.
#define CH_CFG_IDLE_ENTER_HOOK()
Idle thread enter hook.
#define CH_STATE_SUSPENDED
Suspended state.
thread_t * current
The currently running thread.
#define chSysLockFromISR()
Enters the kernel lock state from within an interrupt handler.
#define chSysSwitch(ntp, otp)
Performs a context switch.
System instance data structure.
#define CH_STATE_WTCOND
On a cond.variable.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
#define likely(x)
Marks a boolean expression as likely true.
#define chDbgCheck(c)
Function parameters check.
void chSchPreemption(void)
All-in-one preemption code.
void chSchDoYieldS(void)
Yields the time slot.
static ch_priority_queue_t * ch_pqueue_insert_ahead(ch_priority_queue_t *pqp, ch_priority_queue_t *p)
Inserts an element in the priority queue placing it ahead of its peers.
Structure representing a thread.
static thread_t * __sch_ready_behind(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
void chSchGoSleepS(tstate_t newstate)
Puts the current thread to sleep into the specified state.
#define CH_STATE_CURRENT
Currently running.
union ch_thread::@0 hdr
Shared list headers.
tslices_t ticks
Number of ticks remaining to this thread.
static ch_priority_queue_t * ch_pqueue_remove_highest(ch_priority_queue_t *pqp)
Removes the highest priority element from a priority queue and returns it.
#define CH_STATE_FINAL
Thread terminated.
static ch_priority_queue_t * ch_pqueue_insert_behind(ch_priority_queue_t *pqp, ch_priority_queue_t *p)
Inserts an element in the priority queue placing it behind its peers.
union ch_thread::@1 u
State-specific fields.
Structure representing a generic bidirectional linked list header and element.
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
#define firstprio(rlp)
Returns the priority of the first thread on the given ready list.
#define __instance_get_currthread(oip)
Current thread pointer get macro.
void ch_sch_prio_insert(ch_queue_t *qp, ch_queue_t *tp)
Inserts a thread into a priority ordered queue.
Structure representing a Virtual Timer.
static void chSysNotifyInstance(os_instance_t *oip)
Notifies an OS instance to check for reschedule.
thread_t * chSchSelectFirstI(void)
Makes runnable the fist thread in the ready list, does not reschedule internally.
void chSchDoPreemption(void)
Switches to the first thread on the runnable queue.
bool chSchIsPreemptionRequired(void)
Evaluates if preemption is required.
uint64_t sysinterval_t
Type of time interval.
ch_priority_queue_t * next
Next in the queue.
void chVTDoResetI(virtual_timer_t *vtp)
Disables a Virtual Timer.
#define CH_STATE_QUEUED
On a queue.
static thread_t * __sch_ready_ahead(thread_t *tp)
Inserts a thread in the Ready List placing it ahead its peers.
ch_queue_t queue
Threads queues element.
tstate_t state
Current thread state.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
void __trace_ready(thread_t *tp, msg_t msg)
Inserts in the circular debug trace buffer a ready record.
#define unlikely(x)
Marks a boolean expression as likely false.
static void __sch_reschedule_behind(void)
Switches to the first thread on the runnable queue.
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par)
Enables a one-shot virtual timer.
static ch_queue_t * ch_queue_dequeue(ch_queue_t *p)
Removes an element from a queue and returns it.
ready_list_t rlist
Ready list header.
os_instance_t * owner
OS instance owner of this thread.
tprio_t prio
Priority of this element.
ch_priority_queue_t pqueue
Threads ordered queues header.
#define CH_STATE_WTSEM
On a semaphore.
void chSchWakeupS(thread_t *ntp, msg_t msg)
Wakes up a thread.
static thread_t * chSysGetIdleThreadX(void)
Returns a pointer to the idle thread.