MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / rt_timer_detach

Function rt_timer_detach

src/timer.c:293–314  ·  view source on GitHub ↗

* @brief This function will detach a timer from timer management. * * @param timer is the timer to be detached * * @return the status of detach */

Source from the content-addressed store, hash-verified

291 * @return the status of detach
292 */
293rt_err_t rt_timer_detach(rt_timer_t timer)
294{
295 rt_base_t level;
296 struct rt_spinlock *spinlock;
297
298 /* parameter check */
299 RT_ASSERT(timer != RT_NULL);
300 RT_ASSERT(rt_object_get_type(&timer->parent) == RT_Object_Class_Timer);
301 RT_ASSERT(rt_object_is_systemobject(&timer->parent));
302
303 spinlock = _timerlock_idx(timer);
304 level = rt_spin_lock_irqsave(spinlock);
305
306 _timer_remove(timer);
307 /* stop timer */
308 timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
309
310 rt_spin_unlock_irqrestore(spinlock, level);
311 rt_object_detach(&(timer->parent));
312
313 return RT_EOK;
314}
315RTM_EXPORT(rt_timer_detach);
316
317#ifdef RT_USING_HEAP

Callers 13

rt_led_registerFunction · 0.85
rt_led_unregisterFunction · 0.85
rt_lptimer_detachFunction · 0.85
rt_link_deinitFunction · 0.85
dlmodule_destroyFunction · 0.85
rt_thread_closeFunction · 0.85
test_static_timerFunction · 0.85
test_timer_stressFunction · 0.85

Calls 7

rt_object_get_typeFunction · 0.85
_timerlock_idxFunction · 0.85
_timer_removeFunction · 0.85
rt_object_detachFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.70

Tested by 6

test_static_timerFunction · 0.68
test_timer_stressFunction · 0.68