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

Function _sched_remove_thread_locked

src/scheduler_mp.c:365–406  ·  view source on GitHub ↗

remove thread from ready queue */

Source from the content-addressed store, hash-verified

363
364/* remove thread from ready queue */
365static void _sched_remove_thread_locked(struct rt_thread *thread)
366{
367 LOG_D("%s [%.*s], the priority: %d", __func__,
368 RT_NAME_MAX, thread->parent.name,
369 RT_SCHED_PRIV(thread).current_priority);
370
371 /* remove thread from ready list */
372 rt_list_remove(&RT_THREAD_LIST_NODE(thread));
373
374 if (RT_SCHED_CTX(thread).bind_cpu == RT_CPUS_NR)
375 {
376 if (rt_list_isempty(&(rt_thread_priority_table[RT_SCHED_PRIV(thread).current_priority])))
377 {
378#if RT_THREAD_PRIORITY_MAX > 32
379 rt_thread_ready_table[RT_SCHED_PRIV(thread).number] &= ~RT_SCHED_PRIV(thread).high_mask;
380 if (rt_thread_ready_table[RT_SCHED_PRIV(thread).number] == 0)
381 {
382 rt_thread_ready_priority_group &= ~RT_SCHED_PRIV(thread).number_mask;
383 }
384#else
385 rt_thread_ready_priority_group &= ~RT_SCHED_PRIV(thread).number_mask;
386#endif /* RT_THREAD_PRIORITY_MAX > 32 */
387 }
388 }
389 else
390 {
391 struct rt_cpu *pcpu = rt_cpu_index(RT_SCHED_CTX(thread).bind_cpu);
392
393 if (rt_list_isempty(&(pcpu->priority_table[RT_SCHED_PRIV(thread).current_priority])))
394 {
395#if RT_THREAD_PRIORITY_MAX > 32
396 pcpu->ready_table[RT_SCHED_PRIV(thread).number] &= ~RT_SCHED_PRIV(thread).high_mask;
397 if (pcpu->ready_table[RT_SCHED_PRIV(thread).number] == 0)
398 {
399 pcpu->priority_group &= ~RT_SCHED_PRIV(thread).number_mask;
400 }
401#else
402 pcpu->priority_group &= ~RT_SCHED_PRIV(thread).number_mask;
403#endif /* RT_THREAD_PRIORITY_MAX > 32 */
404 }
405 }
406}
407
408/**
409 * @brief Initialize the system scheduler.

Callers 3

rt_sched_remove_threadFunction · 0.85

Calls 3

rt_list_removeFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_cpu_indexFunction · 0.70

Tested by

no test coverage detected