| 265 | } |
| 266 | |
| 267 | void threadSystemExit(ThreadSystem* thandle, const struct ThreadSystemExitDesc* desc) |
| 268 | { |
| 269 | struct ThreadSystemData* t = *thandle; |
| 270 | if (!t) |
| 271 | return; |
| 272 | *thandle = NULL; |
| 273 | |
| 274 | acquireMutex(&t->mutex); |
| 275 | t->stop = true; |
| 276 | if (desc->abandonTasks) |
| 277 | t->stopAbandon = true; |
| 278 | wakeAllConditionVariable(&t->conditionTasks); |
| 279 | releaseMutex(&t->mutex); |
| 280 | |
| 281 | if (!desc->detachThreads) |
| 282 | { |
| 283 | for (uint64_t ti = 0; ti < t->threadCount; ++ti) |
| 284 | joinThread(t->threads[ti]); |
| 285 | } |
| 286 | else |
| 287 | { |
| 288 | for (uint64_t ti = 0; ti < t->threadCount; ++ti) |
| 289 | detachThread(t->threads[ti]); |
| 290 | } |
| 291 | |
| 292 | releaseThreadSystemHandle(t); |
| 293 | } |
| 294 | |
| 295 | void threadSystemAddTasks(ThreadSystem thandle, TaskFunc func, uint64_t count, uint64_t userSize, void* users) |
| 296 | { |
no test coverage detected