| 719 | } |
| 720 | |
| 721 | void TaskGroup::sched(TaskGroup** pg) { |
| 722 | TaskGroup* g = *pg; |
| 723 | bthread_t next_tid = 0; |
| 724 | // Find next task to run, if none, switch to idle thread of the group. |
| 725 | #ifndef BTHREAD_FAIR_WSQ |
| 726 | const bool popped = g->_rq.pop(&next_tid); |
| 727 | #else |
| 728 | const bool popped = g->_rq.steal(&next_tid); |
| 729 | #endif |
| 730 | if (!popped && !g->steal_task(&next_tid)) { |
| 731 | // Jump to main task if there's no task to run. |
| 732 | next_tid = g->_main_tid; |
| 733 | } |
| 734 | sched_to(pg, next_tid); |
| 735 | } |
| 736 | |
| 737 | extern void CheckBthreadScheSafety(); |
| 738 |
nothing calls this directly
no test coverage detected