* @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
| 32 | * - Calls rt_sched_thread_init_priv() for private scheduling data initialization |
| 33 | */ |
| 34 | void 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 |
no test coverage detected