| 117 | } |
| 118 | |
| 119 | Task* createSubTask(const char* name, TaskFunc func, TaskFunc localRunFunc) |
| 120 | { |
| 121 | if (!s_tasks) |
| 122 | { |
| 123 | createRootTask(); |
| 124 | } |
| 125 | |
| 126 | Task* newTask = (Task*)allocFromChunkedArray(s_tasks); |
| 127 | assert(newTask); |
| 128 | |
| 129 | s_taskCount++; |
| 130 | strcpy(newTask->name, name); |
| 131 | |
| 132 | // Insert newTask at the head of the subtask list in the current "mainline" task. |
| 133 | newTask->next = s_curTask->subtaskNext; |
| 134 | newTask->prev = nullptr; |
| 135 | if (s_curTask->subtaskNext) |
| 136 | { |
| 137 | s_curTask->subtaskNext->prev = newTask; |
| 138 | } |
| 139 | s_curTask->subtaskNext = newTask; |
| 140 | |
| 141 | // The subtask parent is the current task. |
| 142 | newTask->subtaskParent = s_curTask; |
| 143 | // This task has no subtasks. |
| 144 | newTask->subtaskNext = nullptr; |
| 145 | newTask->retTask = nullptr; |
| 146 | newTask->userData = nullptr; |
| 147 | newTask->framebreak = JFALSE; |
| 148 | |
| 149 | newTask->nextTick = 0; |
| 150 | |
| 151 | newTask->context = { 0 }; |
| 152 | newTask->context.callstack[0] = func; |
| 153 | newTask->localRunFunc = localRunFunc; |
| 154 | newTask->context.level = TASK_INIT_LEVEL; |
| 155 | return newTask; |
| 156 | } |
| 157 | |
| 158 | Task* createTask(const char* name, TaskFunc func, JBool framebreak, TaskFunc localRunFunc) |
| 159 | { |
no test coverage detected