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

Function rt_thread_idle_delhook

src/idle.c:95–116  ·  view source on GitHub ↗

* @brief delete the idle hook on hook list. * * @param hook the specified hook function. * * @return `RT_EOK`: delete OK. * `-RT_ENOSYS`: hook was not found. */

Source from the content-addressed store, hash-verified

93 * `-RT_ENOSYS`: hook was not found.
94 */
95rt_err_t rt_thread_idle_delhook(void (*hook)(void))
96{
97 rt_size_t i;
98 rt_err_t ret = -RT_ENOSYS;
99 rt_base_t level;
100
101 level = rt_spin_lock_irqsave(&_hook_spinlock);
102
103 for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++)
104 {
105 if (idle_hook_list[i] == hook)
106 {
107 idle_hook_list[i] = RT_NULL;
108 ret = RT_EOK;
109 break;
110 }
111 }
112
113 rt_spin_unlock_irqrestore(&_hook_spinlock, level);
114
115 return ret;
116}
117
118#endif /* RT_USING_IDLE_HOOK */
119

Callers 4

wdt_taskFunction · 0.85
wdt_taskFunction · 0.85
wdt_taskFunction · 0.85
thread4_entryFunction · 0.85

Calls 2

rt_spin_lock_irqsaveFunction · 0.70

Tested by 3

wdt_taskFunction · 0.68
wdt_taskFunction · 0.68
wdt_taskFunction · 0.68