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

Function rt_event_detach

src/ipc.c:1830–1848  ·  view source on GitHub ↗

* @brief This function will detach a static event object. * * @note This function is used to detach a static event object which is initialized by rt_event_init() function. * By contrast, the rt_event_delete() function will delete an event object. * When the event is successfully detached, it will resume all suspended threads in the event list. * * @see rt_even

Source from the content-addressed store, hash-verified

1828 * ONLY USE the rt_event_delete() function to complete the deletion.
1829 */
1830rt_err_t rt_event_detach(rt_event_t event)
1831{
1832 rt_base_t level;
1833
1834 /* parameter check */
1835 RT_ASSERT(event != RT_NULL);
1836 RT_ASSERT(rt_object_get_type(&event->parent.parent) == RT_Object_Class_Event);
1837 RT_ASSERT(rt_object_is_systemobject(&event->parent.parent));
1838
1839 level = rt_spin_lock_irqsave(&(event->spinlock));
1840 /* resume all suspended thread */
1841 rt_susp_list_resume_all(&(event->parent.suspend_thread), RT_ERROR);
1842 rt_spin_unlock_irqrestore(&(event->spinlock), level);
1843
1844 /* detach event object */
1845 rt_object_detach(&(event->parent.parent));
1846
1847 return RT_EOK;
1848}
1849RTM_EXPORT(rt_event_detach);
1850
1851#ifdef RT_USING_HEAP

Callers 10

rt_wlan_complete_createFunction · 0.85
rt_wlan_complete_deleteFunction · 0.85
rt_link_deinitFunction · 0.85
dlmodule_destroyFunction · 0.85
~ThreadMethod · 0.85
at_client_deInitFunction · 0.85
test_event_initFunction · 0.85
test_event_detachFunction · 0.85

Calls 6

rt_object_get_typeFunction · 0.85
rt_susp_list_resume_allFunction · 0.85
rt_object_detachFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.70

Tested by 3

test_event_initFunction · 0.68
test_event_detachFunction · 0.68