| 81 | } |
| 82 | } |
| 83 | void 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 |
no test coverage detected