inline __attribute__()

in thread/thread.cpp [1234:1276]


    inline __attribute__((always_inline))
    int resume_threads_inlined(vcpu_t* vcpu, const RunQ& runq)
    {
        int count = 0;
        thread_list list;
        auto& standbyq = vcpu->standbyq;
        auto& sleepq = vcpu->sleepq;
        // threads interrupted by other vcpus were not popped from sleepq
        if ((list.node = standbyq.eject_whole_atomic())) {
            for (auto th: list) {
                assert(th->state == states::STANDBY);
                th->state = states::READY;
                sleepq.pop(th);
                count++;
            }
            goto insert_list;
        }
        if (likely(sleepq.empty() || !if_update_now())) {
            assert(count == 0);
            return count;
        }
        do {
            auto th = sleepq.front();
            if (th->ts_wakeup > now) break;
            SCOPED_LOCK(th->lock);
            sleepq.pop_front();
            if (likely(th->state == states::SLEEPING)) {
                th->dequeue_ready_atomic();
            } else {
                // interrupted between standbyq.eject_whole_atomic()
                // and SCOPED_LOCK(th->lock).
                assert(th->state == states::STANDBY);
                th->state = states::READY;
            }
            list.push_back(th);
            count++;
        } while(!sleepq.empty());
        if (count) {
insert_list:
            AtomicRunQ(runq).insert_list_before(list);
        }
        return count;
    }