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

Function rt_thread_idle_sethook

src/idle.c:59–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57static struct rt_spinlock _hook_spinlock;
58
59rt_err_t rt_thread_idle_sethook(void (*hook)(void))
60{
61 rt_size_t i;
62 rt_err_t ret = -RT_EFULL;
63 rt_base_t level;
64
65 level = rt_spin_lock_irqsave(&_hook_spinlock);
66
67 for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++)
68 {
69 if (idle_hook_list[i] == RT_NULL)
70 {
71 idle_hook_list[i] = hook;
72 ret = RT_EOK;
73 break;
74 }
75 }
76
77 rt_spin_unlock_irqrestore(&_hook_spinlock, level);
78
79 return ret;
80}
81
82/**
83 * @addtogroup group_thread_management

Callers 15

cpu_usage_initFunction · 0.85
rtthread_startupFunction · 0.85
rtthread_startupFunction · 0.85
utest_initFunction · 0.85
ht32_dcd_initFunction · 0.85
wdt_taskFunction · 0.85
wdt_taskFunction · 0.85
wdt_taskFunction · 0.85
wdt_sampleFunction · 0.85
rt_hw_board_initFunction · 0.85
wdt_sampleFunction · 0.85
test_wdtFunction · 0.85

Calls 2

rt_spin_lock_irqsaveFunction · 0.70

Tested by 7

utest_initFunction · 0.68
wdt_taskFunction · 0.68
wdt_taskFunction · 0.68
wdt_taskFunction · 0.68
wdt_sampleFunction · 0.68
test_wdtFunction · 0.68
test_idle_hookFunction · 0.68