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

Function rt_sched_thread_init_ctx

src/scheduler_comm.c:34–46  ·  view source on GitHub ↗

* @brief Initialize thread scheduling context * * @param thread The thread to be initialized * @param tick Initial time slice value for the thread * @param priority Initial priority of the thread * * @details This function performs the following initialization: * - Sets thread status to INIT * - For SMP systems: * * Sets bind CPU to none (RT_CPUS_NR) * * Marks CPU as detached

Source from the content-addressed store, hash-verified

32 * - Calls rt_sched_thread_init_priv() for private scheduling data initialization
33 */
34void rt_sched_thread_init_ctx(struct rt_thread *thread, rt_uint32_t tick, rt_uint8_t priority)
35{
36 /* setup thread status */
37 RT_SCHED_CTX(thread).stat = RT_THREAD_INIT;
38
39#ifdef RT_USING_SMP
40 /* not bind on any cpu */
41 RT_SCHED_CTX(thread).bind_cpu = RT_CPUS_NR;
42 RT_SCHED_CTX(thread).oncpu = RT_CPU_DETACHED;
43#endif /* RT_USING_SMP */
44
45 rt_sched_thread_init_priv(thread, tick, priority);
46}
47
48/**
49 * @brief Start the thread timer for scheduling

Callers 1

_thread_initFunction · 0.85

Calls 1

Tested by

no test coverage detected