????????????????????????????????????????У??????????????????????????????????£?

??????1???ж??????????

??????2???ж????????????????????????????????

??????3???ж????????????????????????

??????4???ж??????????????????з????仯????????????????????????????????????????У?

??????5??????????????????????

??????6???????????

??????????Щ????o????????????????????????????????????

RAW_U16  raw_mutex_delete(RAW_MUTEX *mutex_ptr)
  {
   LIST *block_list_head;
  
   RAW_TASK_OBJ  *mutex_occupy;
  
   RAW_SR_ALLOC();
 
   #if (RAW_MUTEX_FUNCTION_CHECK > 0)
 
   if (mutex_ptr == 0) {
    return RAW_NULL_OBJECT;
   }
  
   #endif
 
   block_list_head = &mutex_ptr->common_block_obj.block_list;
  
   RAW_CRITICAL_ENTER();
 
   mutex_occupy = mutex_ptr->occupy;   
   /*if mutex is occupied and occupy priority is not the original priority*/
   if ((mutex_occupy) &&  (mutex_occupy->priority !=  mutex_ptr->occupy_original_priority)) {
    switch (mutex_occupy->task_state) {                    
     case RAW_RDY:
      /*remove from the ready list*/
      remove_ready_list(&raw_ready_queue?? mutex_ptr->occupy);
      /*raise the occupy task priority*/
      mutex_occupy->priority =  mutex_ptr->occupy_original_priority;
      /*readd to the ready list head*/
      add_ready_list_end(&raw_ready_queue?? mutex_ptr->occupy);
      break;
 
     case RAW_DLY:
     case RAW_SUSPENDED:
     case RAW_DLY_SUSPENDED:
      /*occupy task is not on any list?? so just change the priority*/
      mutex_occupy->priority = mutex_ptr->occupy_original_priority;
      break;
 
     case RAW_PEND:
     case RAW_PEND_TIMEOUT:
     case RAW_PEND_SUSPENDED:
     case RAW_PEND_TIMEOUT_SUSPENDED:
      /*occupy task is on the block list so change the priority on the block list*/
      mutex_occupy->priority = mutex_ptr->occupy_original_priority;
      change_pend_list_priority(mutex_occupy);
 
      break;
 
     default:
      RAW_CRITICAL_EXIT();
      return RAW_STATE_UNKNOWN;
    }
   }
 
  
   /*All task blocked on this queue is waken up*/
   while (!is_list_empty(block_list_head)) {
    delete_pend_obj(list_entry(block_list_head->next?? RAW_TASK_OBJ?? task_list));
   }            
 
   RAW_CRITICAL_EXIT();
 
   raw_sched();
  
   return RAW_SUCCESS;
  }

??????????????????????????δ??????????????????????????????????????????????????????????????????????????????????????????????????е??????????????????????

??????1???ж?????????????

??????2???ж??????????????????????????????????κ?????????????????????????????????????

??????3?????????е????????????????suspend????????????suspend??

??????4??????????????????????????????????????????????

??????5?????????????????