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

Method set_status

src/bthread/task_tracer.cpp:140–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void TaskTracer::set_status(TaskStatus s, TaskMeta* m) {
141 CHECK_NE(TASK_STATUS_RUNNING, s) << "Use `set_running_status' instead";
142 CHECK_NE(TASK_STATUS_END, s) << "Use `set_end_status_unsafe' instead";
143
144 bool tracing = false;
145 {
146 BAIDU_SCOPED_LOCK(m->version_lock);
147 if (TASK_STATUS_UNKNOWN == m->status && TASK_STATUS_JUMPING == s) {
148 // Do not update status for jumping when bthread is ending.
149 return;
150 }
151
152 tracing = m->traced;
153 // bthread is scheduled for the first time.
154 if (TASK_STATUS_READY == s && NULL == m->stack) {
155 m->status = TASK_STATUS_FIRST_READY;
156 } else {
157 m->status = s;
158 }
159 if (TASK_STATUS_CREATED == s) {
160 m->worker_tid = pthread_t{};
161 }
162 }
163
164 // Make sure bthread does not jump stack when it is being traced.
165 if (tracing && TASK_STATUS_JUMPING == s) {
166 WaitForTracing(m);
167 }
168}
169
170void TaskTracer::set_running_status(pthread_t worker_tid, TaskMeta* m) {
171 BAIDU_SCOPED_LOCK(m->version_lock);

Callers 13

GenerateReportMethod · 0.80
CheckMethod · 0.80
wait_for_butexFunction · 0.80
task_runnerMethod · 0.80
start_foregroundMethod · 0.80
start_backgroundMethod · 0.80
sched_toMethod · 0.80
ready_to_runMethod · 0.80
ready_to_run_remoteMethod · 0.80
priority_to_runMethod · 0.80

Calls

no outgoing calls

Tested by 1

GenerateReportMethod · 0.64