69 #if CH_CFG_USE_REGISTRY == TRUE 75 #if (CH_CFG_OPTIMIZE_SPEED == FALSE) || defined(__DOXYGEN__) 94 tp->
queue.prev->queue.next = tp;
109 tp->
queue.prev = tqp->prev;
110 tp->
queue.prev->queue.next = tp;
127 tqp->next = tp->
queue.next;
128 tqp->next->queue.prev = (
thread_t *)tqp;
146 tqp->prev = tp->
queue.prev;
147 tqp->prev->queue.next = (
thread_t *)tqp;
231 }
while (cp->prio >= tp->prio);
234 tp->queue.prev = cp->queue.prev;
235 tp->queue.prev->queue.next = tp;
270 }
while (cp->prio > tp->prio);
273 tp->queue.prev = cp->queue.prev;
274 tp->queue.prev->queue.next = tp;
295 otp->
state = newstate;
297 #if CH_CFG_TIME_QUANTUM > 0 319 static void wakeup(
void *p) {
332 #if CH_CFG_USE_SEMAPHORES == TRUE 339 #if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE) 392 return currp->u.rdymsg;
418 (ch.
rlist.current->prio >= ch.
rlist.queue.next->prio),
419 "priority order violation");
465 #if !defined(CH_SCH_IS_PREEMPTION_REQUIRED_HOOKED) 483 #if CH_CFG_TIME_QUANTUM > 0 519 #if CH_CFG_TIME_QUANTUM > 0 559 #if !defined(CH_SCH_DO_RESCHEDULE_HOOKED) 582 #if CH_CFG_TIME_QUANTUM > 0 void _scheduler_init(void)
Scheduler initialization.
uint64_t sysinterval_t
Type of time interval.
tprio_t prio
Thread priority.
#define NOPRIO
Ready list header priority.
#define chSemFastSignalI(sp)
Increases the semaphore counter.
void chSchDoRescheduleBehind(void)
Switches to the first thread on the runnable queue.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
void queue_prio_insert(thread_t *tp, threads_queue_t *tqp)
Inserts a thread into a priority ordered queue.
#define IDLEPRIO
Idle priority.
#define CH_STATE_SUSPENDED
Suspended state.
#define CH_STATE_CURRENT
Currently running.
#define firstprio(rlp)
Returns the priority of the first thread on the given ready list.
#define currp
Current thread pointer access macro.
msg_t rdymsg
Thread wakeup code.
#define CH_STATE_WTCOND
On a cond.variable.
#define chSchIsRescRequiredI()
Evaluates if a reschedule is required.
#define CH_CFG_IDLE_ENTER_HOOK()
Idle thread enter hook.
thread_t * next
Next in the list/queue.
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par)
Enables a virtual timer.
#define chDbgCheck(c)
Function parameters check.
void chVTDoResetI(virtual_timer_t *vtp)
Disables a Virtual Timer.
#define CH_STATE_FINAL
Thread terminated.
bool chSchIsPreemptionRequired(void)
Evaluates if preemption is required.
#define chSysUnlockFromISR()
Leaves the kernel lock state from within an interrupt handler.
tslices_t ticks
Number of ticks remaining to this thread.
void chSchGoSleepS(tstate_t newstate)
Puts the current thread to sleep into the specified state.
static void queue_init(threads_queue_t *tqp)
Threads queue initialization.
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
thread_t * list_remove(threads_list_t *tlp)
Pops a thread from the top of a stack list and returns it.
static bool chVTIsArmedI(const virtual_timer_t *vtp)
Returns true if the specified timer is armed.
ready_list_t rlist
Ready list header.
ch_system_t ch
System data structures.
Generic threads single link list, it works like a stack.
void queue_insert(thread_t *tp, threads_queue_t *tqp)
Inserts a thread into a queue.
thread_t * queue_lifo_remove(threads_queue_t *tqp)
Removes the last-out thread from a queue and returns it.
#define CH_STATE_READY
Waiting on the ready list.
#define chSysLockFromISR()
Enters the kernel lock state from within an interrupt handler.
void chSchDoRescheduleAhead(void)
Switches to the first thread on the runnable queue.
tstate_t state
Current thread state.
#define CH_STATE_WTSEM
On a semaphore.
Virtual Timer descriptor structure.
union ch_thread::@0 u
State-specific fields.
#define CH_CFG_TIME_QUANTUM
Round robin interval.
#define CH_CFG_IDLE_LEAVE_HOOK()
Idle thread leave hook.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
thread_t * queue_dequeue(thread_t *tp)
Removes a thread from a queue and returns it.
void chSchWakeupS(thread_t *ntp, msg_t msg)
Wakes up a thread.
#define chDbgAssert(c, r)
Condition assertion.
#define CH_STATE_QUEUED
On an I/O queue.
thread_t * chSchReadyAheadI(thread_t *tp)
Inserts a thread in the Ready List placing it ahead its peers.
void list_insert(thread_t *tp, threads_list_t *tlp)
Pushes a thread_t on top of a stack list.
thread_reference_t * wttrp
Pointer to a generic thread reference object.
thread_t * queue_fifo_remove(threads_queue_t *tqp)
Removes the first-out thread from a queue and returns it.
#define chSysSwitch(ntp, otp)
Performs a context switch.
threads_queue_t queue
Threads queue header.
void chSchDoReschedule(void)
Switches to the first thread on the runnable queue.
Structure representing a thread.