MCPcopy Create free account
hub / github.com/apache/brpc / sched

Method sched

src/bthread/task_group.cpp:721–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719}
720
721void 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
737extern void CheckBthreadScheSafety();
738

Callers

nothing calls this directly

Calls 3

stealMethod · 0.80
popMethod · 0.45
steal_taskMethod · 0.45

Tested by

no test coverage detected