/* Dispatch specified Thread or Ready Thread with Highest Priority.  */
void osRtxThreadDispatch(os_thread_t *thread)
/* Dispatch specified Thread or Ready Thread with Highest Priority.  */
void osRtxThreadDispatch(os_thread_t *thread)
{
    thread_ready = osRtxInfo.thread.ready.thread_list;
    if ((kernel_state == osRtxKernelRunning) &&
        (thread_ready != NULL) &&
        (thread_ready->priority > thread_running->priority)) {
      osRtxThreadListRemove(thread_ready);
      osRtxThreadBlock(thread_running);
      osRtxThreadSwitch(thread_ready);
    }
  } else {
    if ((kernel_state == osRtxKernelRunning) &&
        (thread->priority > thread_running->priority)) {
      osRtxThreadBlock(thread_running);
      osRtxThreadSwitch(thread);
    } else {
      osRtxThreadReadyPut(thread);
    }
  }
}