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

Method ready_to_run_remote

src/bthread/task_group.cpp:875–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

873}
874
875void TaskGroup::ready_to_run_remote(TaskMeta* meta, bool nosignal) {
876#ifdef BRPC_BTHREAD_TRACER
877 _control->_task_tracer.set_status(TASK_STATUS_READY, meta);
878#endif // BRPC_BTHREAD_TRACER
879 _remote_rq._mutex.lock();
880 while (!_remote_rq.push_locked(meta->tid)) {
881 flush_nosignal_tasks_remote_locked(_remote_rq._mutex);
882 LOG_EVERY_SECOND(ERROR) << "_remote_rq is full, capacity="
883 << _remote_rq.capacity();
884 ::usleep(1000);
885 _remote_rq._mutex.lock();
886 }
887 if (nosignal) {
888 ++_remote_num_nosignal;
889 _remote_rq._mutex.unlock();
890 } else {
891 const int additional_signal = _remote_num_nosignal;
892 _remote_num_nosignal = 0;
893 _remote_nsignaled += 1 + additional_signal;
894 _remote_rq._mutex.unlock();
895 _control->signal_task(1 + additional_signal, _tag);
896 }
897}
898
899void TaskGroup::flush_nosignal_tasks_remote_locked(butil::Mutex& locked_mutex) {
900 const int val = _remote_num_nosignal;

Callers 5

butex_wakeFunction · 0.80
butex_wake_nFunction · 0.80
butex_requeueFunction · 0.80
interruptMethod · 0.80

Calls 6

set_statusMethod · 0.80
push_lockedMethod · 0.80
signal_taskMethod · 0.80
lockMethod · 0.45
capacityMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected