??????棬??????????????????????????change_interal_task_priority??????????????????????????????????????????????????????????????????????????????л?????????У???????e??????????????????????????????????????????

RAW_VOID mtx_chg_pri(RAW_TASK_OBJ *tcb?? RAW_U8 oldpri)
{
 RAW_MUTEX  *mtxcb;
 RAW_TASK_OBJ *mtxtsk;

 mtxcb = (RAW_MUTEX *)(tcb->block_obj);
 
 if (mtxcb->common_block_obj.object_type == RAW_MUTEX_OBJ_TYPE) {
 
  if (mtxcb->policy == RAW_MUTEX_INHERIT_POLICY) {
   mtxtsk = mtxcb->mtxtsk;
  
   if (mtxtsk->priority > tcb->priority) {
    /* Since the highest priority of the lock wait task
       became higher?? raise the lock get task priority
       higher */
    change_interal_task_priority(mtxtsk?? tcb->priority);
   }

   /*the highest priority task blocked on this mutex may decrease priority so reset the mutex task priority*/
   else if(mtxtsk->priority == oldpri) {

    release_mutex(mtxtsk?? 0);
   }
  
  }
 }

}

????mtx_chg_pri????????????????????????????????????????????????л????????????????????????????????????????release_mutex??????????Щ??????

static RAW_VOID release_mutex(RAW_TASK_OBJ *tcb?? RAW_MUTEX *relmtxcb)
{
 RAW_MUTEX *mtxcb?? **prev;
 RAW_U8 newpri?? pri;
 RAW_TASK_OBJ *first_block_task;
 LIST *block_list_head;
 
 /* (B) The base priority of task */
 newpri = tcb->bpriority;

 /* (A) The highest priority in mutex which is locked */
 pri = newpri;
 prev = &tcb->mtxlist;
 while ((mtxcb = *prev) != 0) {
  if (mtxcb == relmtxcb) {
   /* Delete from list */
   *prev = mtxcb->mtxlist;
   continue;
  }

  switch (mtxcb->policy) {
    case RAW_MUTEX_CEILING_POLICY:
   pri = mtxcb->ceiling_prio;
   break;
  
    case RAW_MUTEX_INHERIT_POLICY:
    
     block_list_head = &mtxcb->common_block_obj.block_list;
  
   if (!is_list_empty(block_list_head)) {
    first_block_task = list_entry(block_list_head->next?? RAW_TASK_OBJ?? task_list);
    pri = first_block_task->priority;
   }
  
   break;
  
    default:
   break;
  }
  if (newpri > pri) {
   newpri = pri;
  }

  prev = &mtxcb->mtxlist;
 }

 if ( newpri != tcb->priority ) {
  /* Change priority of lock get task */
  change_interal_task_priority(tcb?? newpri);
 }
 
}

???????????????????????????????????????????????????????????????????????????change_internall_task_priority????????й???麯????д???????????????????????????????麯????change_internall_task_priority?????????release_mutex?????release_mutex??????change_internall_task_priority???о???????????????????????????麯?????????????????????????????change_internall_task_priority????е??????????????????????????????????????????????????????????????????????????鷳?????????????????????????????????л??????????????????????????????????????????????????С?rawos??????????????????????????ж???????????????????????????????????????????????????????????????????????Σ??????????????????????????????????