MCPcopy Create free account
hub / github.com/bytedance/bolt / enter

Method enter

bolt/exec/Task.cpp:2792–2816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2790}
2791
2792StopReason Task::enter(ThreadState& state, uint64_t nowMicros) {
2793 BOLT_TEST_ADJUST("bytedance::bolt::exec::Task::enter", &state);
2794 std::lock_guard<std::timed_mutex> l(mutex_);
2795 BOLT_CHECK(state.isEnqueued);
2796 state.isEnqueued = false;
2797 if (state.isTerminated) {
2798 return StopReason::kAlreadyTerminated;
2799 }
2800 if (state.isOnThread()) {
2801 return StopReason::kAlreadyOnThread;
2802 }
2803 const auto reason = shouldStopLocked();
2804 if (reason == StopReason::kTerminate) {
2805 state.isTerminated = true;
2806 }
2807 if (reason == StopReason::kNone) {
2808 ++numThreads_;
2809 if (numThreads_ == 1) {
2810 onThreadSince_ = nowMicros;
2811 }
2812 state.setThread();
2813 state.hasBlockingFuture = false;
2814 }
2815 return reason;
2816}
2817
2818StopReason Task::enterForTerminateLocked(ThreadState& state) {
2819 if (state.isOnThread() || state.isTerminated) {

Callers 1

runInternalMethod · 0.80

Calls 2

setThreadMethod · 0.80
isOnThreadMethod · 0.45

Tested by

no test coverage detected