| 58 | ****************************************************************************/ |
| 59 | |
| 60 | void nxtask_activate(FAR struct tcb_s *tcb) |
| 61 | { |
| 62 | irqstate_t flags = enter_critical_section(); |
| 63 | FAR struct tcb_s *rtcb = this_task(); |
| 64 | |
| 65 | #ifdef CONFIG_SCHED_INSTRUMENTATION |
| 66 | |
| 67 | /* Check if this is really a re-start */ |
| 68 | |
| 69 | if (tcb->task_state != TSTATE_TASK_INACTIVE) |
| 70 | { |
| 71 | /* Inform the instrumentation layer that the task |
| 72 | * has stopped |
| 73 | */ |
| 74 | |
| 75 | sched_note_stop(tcb); |
| 76 | } |
| 77 | |
| 78 | /* Inform the instrumentation layer that the task |
| 79 | * has started |
| 80 | */ |
| 81 | |
| 82 | sched_note_start(tcb); |
| 83 | #endif |
| 84 | |
| 85 | /* Remove the task from waiting list */ |
| 86 | |
| 87 | nxsched_remove_blocked(tcb); |
| 88 | |
| 89 | sinfo("%s pid=%d,TCB=%p\n", get_task_name(tcb), |
| 90 | tcb->pid, tcb); |
| 91 | |
| 92 | /* Add the task to ready-to-run task list, and |
| 93 | * perform the context switch if one is needed |
| 94 | */ |
| 95 | |
| 96 | if (nxsched_add_readytorun(tcb)) |
| 97 | { |
| 98 | up_switch_context(this_task(), rtcb); |
| 99 | } |
| 100 | |
| 101 | leave_critical_section(flags); |
| 102 | } |
no test coverage detected