| 156 | } |
| 157 | |
| 158 | Task* createTask(const char* name, TaskFunc func, JBool framebreak, TaskFunc localRunFunc) |
| 159 | { |
| 160 | if (!s_tasks) |
| 161 | { |
| 162 | createRootTask(); |
| 163 | } |
| 164 | |
| 165 | Task* newTask = (Task*)allocFromChunkedArray(s_tasks); |
| 166 | assert(newTask); |
| 167 | |
| 168 | s_taskCount++; |
| 169 | // Insert the task after 's_taskIter' |
| 170 | strcpy(newTask->name, name); |
| 171 | newTask->next = s_taskIter->next; |
| 172 | // This was missing? |
| 173 | if (s_taskIter->next) |
| 174 | { |
| 175 | s_taskIter->next->prev = newTask; |
| 176 | } |
| 177 | newTask->prev = s_taskIter; |
| 178 | s_taskIter->next = newTask; |
| 179 | |
| 180 | newTask->subtaskNext = nullptr; |
| 181 | newTask->subtaskParent = nullptr; |
| 182 | newTask->retTask = nullptr; |
| 183 | newTask->userData = nullptr; |
| 184 | newTask->framebreak = framebreak; |
| 185 | |
| 186 | newTask->context = { 0 }; |
| 187 | newTask->context.callstack[0] = func; |
| 188 | newTask->localRunFunc = localRunFunc; |
| 189 | newTask->context.level = TASK_INIT_LEVEL; |
| 190 | newTask->nextTick = s_curTick; |
| 191 | |
| 192 | return newTask; |
| 193 | } |
| 194 | |
| 195 | void task_serializeState(Stream* stream, Task* task, void* userData, LocalMemorySerCallback localMemCallback, bool resetIP) |
| 196 | { |
no test coverage detected