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

Function rt_mq_delete

src/ipc.c:3320–3344  ·  view source on GitHub ↗

* @brief This function will delete a messagequeue object and release the memory. * * @note This function is used to delete a messagequeue object which is created by the rt_mq_create() function. * By contrast, the rt_mq_detach() function will detach a static messagequeue object. * When the messagequeue is successfully deleted, it will resume all suspended threads in t

Source from the content-addressed store, hash-verified

3318 * for example,the rt_mq_create() function, it cannot be called in interrupt context.
3319 */
3320rt_err_t rt_mq_delete(rt_mq_t mq)
3321{
3322 /* parameter check */
3323 RT_ASSERT(mq != RT_NULL);
3324 RT_ASSERT(rt_object_get_type(&mq->parent.parent) == RT_Object_Class_MessageQueue);
3325 RT_ASSERT(rt_object_is_systemobject(&mq->parent.parent) == RT_FALSE);
3326
3327 RT_DEBUG_NOT_IN_INTERRUPT;
3328
3329 rt_spin_lock(&(mq->spinlock));
3330 /* resume all suspended thread */
3331 rt_susp_list_resume_all(&(mq->parent.suspend_thread), RT_ERROR);
3332 /* also resume all message queue private suspended thread */
3333 rt_susp_list_resume_all(&(mq->suspend_sender_thread), RT_ERROR);
3334
3335 rt_spin_unlock(&(mq->spinlock));
3336
3337 /* free message queue pool */
3338 RT_KERNEL_FREE(mq->msg_pool);
3339
3340 /* delete message queue object */
3341 rt_object_delete(&(mq->parent.parent));
3342
3343 return RT_EOK;
3344}
3345RTM_EXPORT(rt_mq_delete);
3346#endif /* RT_USING_HEAP */
3347

Callers 13

_object_node_deleteFunction · 0.85
sys_mq_createFunction · 0.85
usb_osal_mq_deleteFunction · 0.85
dlmodule_destroyFunction · 0.85
dfs_mqueue_unlinkFunction · 0.85
dfs_mqueue_unlinkFunction · 0.85
info_entryFunction · 0.85
ab32_pin_irq_initFunction · 0.85
am_adc_stopFunction · 0.85
OS_QueueDeleteFunction · 0.85
hal_queue_deleteFunction · 0.85
test_mq_deleteFunction · 0.85

Calls 6

rt_object_get_typeFunction · 0.85
rt_susp_list_resume_allFunction · 0.85
rt_object_deleteFunction · 0.85
rt_spin_lockFunction · 0.70
rt_spin_unlockFunction · 0.70

Tested by 1

test_mq_deleteFunction · 0.68