* @brief This function will detach a static mutex object. * * @note This function is used to detach a static mutex object which is initialized by rt_mutex_init() function. * By contrast, the rt_mutex_delete() function will delete a mutex object. * When the mutex is successfully detached, it will resume all suspended threads in the mutex list. * * @see rt_mutex
| 1053 | * ONLY USE the rt_mutex_delete() function to complete the deletion. |
| 1054 | */ |
| 1055 | rt_err_t rt_mutex_detach(rt_mutex_t mutex) |
| 1056 | { |
| 1057 | /* parameter check */ |
| 1058 | RT_ASSERT(mutex != RT_NULL); |
| 1059 | RT_ASSERT(rt_object_get_type(&mutex->parent.parent) == RT_Object_Class_Mutex); |
| 1060 | RT_ASSERT(rt_object_is_systemobject(&mutex->parent.parent)); |
| 1061 | |
| 1062 | _mutex_before_delete_detach(mutex); |
| 1063 | |
| 1064 | /* detach mutex object */ |
| 1065 | rt_object_detach(&(mutex->parent.parent)); |
| 1066 | |
| 1067 | return RT_EOK; |
| 1068 | } |
| 1069 | RTM_EXPORT(rt_mutex_detach); |
| 1070 | |
| 1071 | /* drop a thread from the suspend list of mutex */ |