????????????????????? ??????????????????????????????????ò???????????????????????仯???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ɡ?

????rawos?????????256??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????β????????????ε??????????????????????????????????????ж???????????

void caculate_time_slice()
 {
  RAW_TASK_OBJ   *task_ptr;
  LIST *head;
  
  RAW_SR_ALLOC();
 
    task_ptr = raw_task_active;
    head = &raw_ready_queue.task_ready_list[task_ptr->priority];
  
  RAW_CRITICAL_ENTER();
                        
  if (is_list_empty(head)) {
 
   RAW_CRITICAL_EXIT();
   return;
  }
 
  /*there is only one task on this ready list?? so do not need to caculate time slice*/
  if (head->next->next == head)  {
   
   RAW_CRITICAL_EXIT();
   return;
   
  }
 
  if (task_ptr->time_slice) {
   task_ptr->time_slice--;
  }
 
  /*if current active task has time_slice?? just return*/
  if (task_ptr->time_slice) {              
   RAW_CRITICAL_EXIT();
   return;
  }
 
  /*Move current active task to the end of ready list for the same priority*/
  move_to_ready_list_end(&raw_ready_queue?? task_ptr);
 
  /*restore the task time slice*/
  task_ptr->time_slice = task_ptr->time_total; 
  
  RAW_CRITICAL_EXIT();
 }
 

??????????????????????????ж???????????????????????????????????????????????滹?ü????????????????????????windows????????????????????????????????????sleep??0??????????????rawos??????????????

RAW_U16  raw_sleep(RAW_U32  dly)
 {
  RAW_U16 error_status;
  
  RAW_SR_ALLOC();
 
  #if (RAW_TASK_FUNCTION_CHECK > 0)
  
  if (raw_int_nesting) {
   
   return RAW_NOT_CALLED_BY_ISR;
  }
  #endif  
   
  RAW_CRITICAL_ENTER();
 
  if  (dly) {
 
   /*system is locked so task can not sleep just return immediately*/
   if (raw_sched_lock) {  
    RAW_CRITICAL_EXIT(); 
    return RAW_SCHED_DISABLE;
   }
 
   raw_task_active->task_state = RAW_DLY;
 
   tick_list_insert(raw_task_active?? dly);
             
   remove_ready_list(&raw_ready_queue?? raw_task_active);
  }
  
  else { 
   /*make current task to the end of ready list*/
    move_to_ready_list_end(&raw_ready_queue?? raw_task_active);
  }
 
  RAW_CRITICAL_EXIT();
 
  raw_sched();  
 
  if (dly) {
   /*task is timeout after sleep*/
   error_status = block_state_post_process(raw_task_active?? 0);
  }
 
  else {
   
   error_status = RAW_SUCCESS;
 
  }
  
  return error_status;
 }