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

Method QueueMessage

src/brpc/tcp_transport.cpp:83–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82}
83void TcpTransport::QueueMessage(InputMessageClosure& input_msg,
84 int* num_bthread_created, bool) {
85 InputMessageBase* to_run_msg = input_msg.release();
86 if (!to_run_msg) {
87 return;
88 }
89 // Create bthread for last_msg. The bthread is not scheduled
90 // until bthread_flush() is called (in the worse case).
91 bthread_t th;
92 bthread_attr_t tmp =
93 (FLAGS_usercode_in_pthread ? BTHREAD_ATTR_PTHREAD : BTHREAD_ATTR_NORMAL) |
94 BTHREAD_NOSIGNAL;
95 tmp.keytable_pool = _socket->keytable_pool();
96 tmp.tag = bthread_self_tag();
97 bthread_attr_set_name(&tmp, "ProcessInputMessage");
98 if (!FLAGS_usercode_in_coroutine && bthread_start_background(
99 &th, &tmp, ProcessInputMessage, to_run_msg) == 0) {
100 ++*num_bthread_created;
101 } else {
102 ProcessInputMessage(to_run_msg);
103 }
104}
105
106} // namespace brpc

Callers 1

ProcessNewMessageMethod · 0.45

Calls 5

bthread_self_tagFunction · 0.85
bthread_attr_set_nameFunction · 0.85
bthread_start_backgroundFunction · 0.85
ProcessInputMessageFunction · 0.85
releaseMethod · 0.45

Tested by

no test coverage detected