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

Function rt_sem_detach

src/ipc.c:413–431  ·  view source on GitHub ↗

* @brief This function will detach a static semaphore object. * * @note This function is used to detach a static semaphore object which is initialized by rt_sem_init() function. * By contrast, the rt_sem_delete() function will delete a semaphore object. * When the semaphore is successfully detached, it will resume all suspended threads in the semaphore list. * * @s

Source from the content-addressed store, hash-verified

411 * ONLY USE the rt_sem_delete() function to complete the deletion.
412 */
413rt_err_t rt_sem_detach(rt_sem_t sem)
414{
415 rt_base_t level;
416
417 /* parameter check */
418 RT_ASSERT(sem != RT_NULL);
419 RT_ASSERT(rt_object_get_type(&sem->parent.parent) == RT_Object_Class_Semaphore);
420 RT_ASSERT(rt_object_is_systemobject(&sem->parent.parent));
421
422 level = rt_spin_lock_irqsave(&(sem->spinlock));
423 /* wakeup all suspended threads */
424 rt_susp_list_resume_all(&(sem->parent.suspend_thread), RT_ERROR);
425 rt_spin_unlock_irqrestore(&(sem->spinlock), level);
426
427 /* detach semaphore object */
428 rt_object_detach(&(sem->parent.parent));
429
430 return RT_EOK;
431}
432RTM_EXPORT(rt_sem_detach);
433
434#ifdef RT_USING_HEAP

Callers 15

rt_can_closeFunction · 0.85
mmcsd_free_hostFunction · 0.85
blk.cFile · 0.85
rt_cputimer_detachFunction · 0.85
rt_workqueue_createFunction · 0.85
rt_workqueue_destroyFunction · 0.85
utest_tc_cleanupFunction · 0.85
utest_tc_cleanupFunction · 0.85
utest_tc_cleanupFunction · 0.85
utest_tc_cleanupFunction · 0.85
utest_tc_cleanupFunction · 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