| 2003 | return false; |
| 2004 | } |
| 2005 | static void* idler(void*) { |
| 2006 | RunQ rq; |
| 2007 | auto last_idle = now; |
| 2008 | auto vcpu = rq.current->get_vcpu(); |
| 2009 | while (vcpu->state != states::DONE) { |
| 2010 | while (unlikely(resume_threads_inlined(vcpu, rq) > 0) || |
| 2011 | likely(!AtomicRunQ(rq).single()) || |
| 2012 | likely(try_work_stealing(vcpu))) { |
| 2013 | thread_yield(); |
| 2014 | if (vcpu->state == states::DONE) |
| 2015 | break; |
| 2016 | if (unlikely(sat_sub(now, last_idle) >= 1000UL)) { |
| 2017 | vcpu->master_event_engine->wait_and_fire_events(0); |
| 2018 | last_idle = now; |
| 2019 | } |
| 2020 | } |
| 2021 | if (vcpu->state == states::DONE) |
| 2022 | break; |
| 2023 | // only idle stub aliving |
| 2024 | // other threads must be sleeping |
| 2025 | // fall in actual sleep |
| 2026 | auto usec = 10 * 1024 * 1024; // max |
| 2027 | auto& sleepq = vcpu->sleepq; |
| 2028 | if (!sleepq.empty()) usec = min(usec, |
| 2029 | sat_sub(sleepq.front()->ts_wakeup, now)); |
| 2030 | vcpu->master_event_engine->wait_and_fire_events(usec); |
| 2031 | last_idle = now; |
| 2032 | } |
| 2033 | return nullptr; |
| 2034 | } |
| 2035 | /** |
| 2036 | * Waiting for all current vcpu photon threads finish |
| 2037 | * @return 0 for all done, -1 for failure |
nothing calls this directly
no test coverage detected