MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_sched_thread_yield

Function rt_sched_thread_yield

src/scheduler_comm.c:198–206  ·  view source on GitHub ↗

* @brief Yield the current thread's remaining time slice * * @param thread The thread to yield * @return rt_err_t Always returns RT_EOK on success * * @details This function: * - Requires scheduler lock to be held (RT_SCHED_DEBUG_IS_LOCKED) * - Resets the thread's remaining tick count to its initial value * - Sets the thread's status to YIELD state * * @note Must be called with sch

Source from the content-addressed store, hash-verified

196 * @note Must be called with scheduler lock held
197 */
198rt_err_t rt_sched_thread_yield(struct rt_thread *thread)
199{
200 RT_SCHED_DEBUG_IS_LOCKED;
201
202 RT_SCHED_PRIV(thread).remaining_tick = RT_SCHED_PRIV(thread).init_tick;
203 RT_SCHED_CTX(thread).stat |= RT_THREAD_STAT_YIELD;
204
205 return RT_EOK;
206}
207
208/**
209 * @brief Make a suspended thread ready for scheduling

Callers 2

rt_sched_tick_increaseFunction · 0.85
rt_thread_yieldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected