Kill all tasks except the current task. * */
| 104 | * |
| 105 | */ |
| 106 | void task_done(void) |
| 107 | { |
| 108 | size_t tasks_left; |
| 109 | task_t *task; |
| 110 | |
| 111 | if (ipc_box_0) { |
| 112 | task_t *task_0 = ipc_box_0->task; |
| 113 | ipc_box_0 = NULL; |
| 114 | /* |
| 115 | * The first task is held by kinit(), we need to release it or |
| 116 | * it will never finish cleanup. |
| 117 | */ |
| 118 | task_release(task_0); |
| 119 | } |
| 120 | |
| 121 | /* Repeat until there are any tasks except TASK */ |
| 122 | do { |
| 123 | #ifdef CONFIG_DEBUG |
| 124 | printf("Killing tasks... "); |
| 125 | #endif |
| 126 | irq_spinlock_lock(&tasks_lock, true); |
| 127 | tasks_left = 0; |
| 128 | |
| 129 | task = task_first(); |
| 130 | while (task != NULL) { |
| 131 | if (task != TASK) { |
| 132 | tasks_left++; |
| 133 | #ifdef CONFIG_DEBUG |
| 134 | printf("[%" PRIu64 "] ", task->taskid); |
| 135 | #endif |
| 136 | task_kill_internal(task); |
| 137 | } |
| 138 | |
| 139 | task = task_next(task); |
| 140 | } |
| 141 | |
| 142 | irq_spinlock_unlock(&tasks_lock, true); |
| 143 | |
| 144 | thread_sleep(1); |
| 145 | |
| 146 | #ifdef CONFIG_DEBUG |
| 147 | printf("\n"); |
| 148 | #endif |
| 149 | } while (tasks_left > 0); |
| 150 | } |
| 151 | |
| 152 | errno_t tsk_constructor(void *obj, unsigned int kmflags) |
| 153 | { |
no test coverage detected