| 427 | std::atomic<unsigned> _index{0}; |
| 428 | |
| 429 | void run(unsigned i) |
| 430 | { |
| 431 | /* |
| 432 | * initalize per thread objects. |
| 433 | */ |
| 434 | FTOutline outlineRef; |
| 435 | SW_FT_Stroker stroker; |
| 436 | SW_FT_Stroker_New(&stroker); |
| 437 | |
| 438 | // Task Loop |
| 439 | VTask task; |
| 440 | while (true) { |
| 441 | bool success = false; |
| 442 | |
| 443 | for (unsigned n = 0; n != _count * 2; ++n) { |
| 444 | if (_q[(i + n) % _count].try_pop(task)) { |
| 445 | success = true; |
| 446 | break; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | if (!success && !_q[i].pop(task)) break; |
| 451 | |
| 452 | (*task)(outlineRef, stroker); |
| 453 | } |
| 454 | |
| 455 | // cleanup |
| 456 | SW_FT_Stroker_Done(stroker); |
| 457 | } |
| 458 | |
| 459 | RleTaskScheduler() |
| 460 | { |
nothing calls this directly
no test coverage detected