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

Function rt_object_delete

src/object.c:557–584  ·  view source on GitHub ↗

* @brief This function will delete an object and release object memory. * * @param object The specified object to be deleted. */

Source from the content-addressed store, hash-verified

555 * @param object The specified object to be deleted.
556 */
557void rt_object_delete(rt_object_t object)
558{
559 rt_base_t level;
560 struct rt_object_information *information;
561
562 /* object check */
563 RT_ASSERT(object != RT_NULL);
564 RT_ASSERT(!(object->type & RT_Object_Class_Static));
565
566 RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object));
567
568
569 information = rt_object_get_information((enum rt_object_class_type)object->type);
570 RT_ASSERT(information != RT_NULL);
571
572 level = rt_spin_lock_irqsave(&(information->spinlock));
573
574 /* remove from old list */
575 rt_list_remove(&(object->list));
576
577 rt_spin_unlock_irqrestore(&(information->spinlock), level);
578
579 /* reset object type */
580 object->type = RT_Object_Class_Null;
581
582 /* free the memory of object */
583 RT_KERNEL_FREE(object);
584}
585#endif /* RT_USING_HEAP */
586
587/**

Callers 15

_pftx_create_lockedFunction · 0.85
_sftx_createFunction · 0.85
rt_raw_channel_closeFunction · 0.85
channel_fops_closeFunction · 0.85
dlmodule_destroyFunction · 0.85
rt_sem_deleteFunction · 0.85
rt_mutex_deleteFunction · 0.85
rt_event_deleteFunction · 0.85
rt_mb_createFunction · 0.85
rt_mb_deleteFunction · 0.85
rt_mq_createFunction · 0.85

Calls 4

rt_list_removeFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.70

Tested by 2