@@ -1491,8 +1491,10 @@ void Socket::AfterAppConnected(int err, void* data) {
14911491 // requests are not setup yet. check the comment on Setup() in Write()
14921492 req->Setup (s);
14931493 bthread_t th;
1494+ bthread_attr_t attr = BTHREAD_ATTR_NORMAL;
1495+ attr.set_name (" KeepWrite" );
14941496 if (bthread_start_background (
1495- &th, &BTHREAD_ATTR_NORMAL , KeepWrite, req) != 0 ) {
1497+ &th, &attr , KeepWrite, req) != 0 ) {
14961498 PLOG (WARNING) << " Fail to start KeepWrite" ;
14971499 KeepWrite (req);
14981500 }
@@ -1532,7 +1534,9 @@ int Socket::KeepWriteIfConnected(int fd, int err, void* data) {
15321534 bthread_t th;
15331535 std::unique_ptr<google::protobuf::Closure> thrd_func (brpc::NewCallback (
15341536 Socket::CheckConnectedAndKeepWrite, fd, err, data));
1535- if ((err = bthread_start_background (&th, &BTHREAD_ATTR_NORMAL,
1537+ bthread_attr_t attr = BTHREAD_ATTR_NORMAL;
1538+ attr.set_name (" CheckConnectedAndKeepWrite" );
1539+ if ((err = bthread_start_background (&th, &attr,
15361540 RunClosure, thrd_func.get ())) == 0 ) {
15371541 thrd_func.release ();
15381542 return 0 ;
@@ -1705,6 +1709,8 @@ int Socket::StartWrite(WriteRequest* req, const WriteOptions& opt) {
17051709
17061710 int saved_errno = 0 ;
17071711 bthread_t th;
1712+ bthread_attr_t attr = BTHREAD_ATTR_NORMAL;
1713+ attr.set_name (" KeepWrite" );
17081714 SocketUniquePtr ptr_for_keep_write;
17091715 ssize_t nw = 0 ;
17101716 int ret = 0 ;
@@ -1779,7 +1785,7 @@ int Socket::StartWrite(WriteRequest* req, const WriteOptions& opt) {
17791785KEEPWRITE_IN_BACKGROUND:
17801786 ReAddress (&ptr_for_keep_write);
17811787 req->set_socket (ptr_for_keep_write.release ());
1782- if (bthread_start_background (&th, &BTHREAD_ATTR_NORMAL ,
1788+ if (bthread_start_background (&th, &attr ,
17831789 KeepWrite, req) != 0 ) {
17841790 LOG (FATAL) << " Fail to start KeepWrite" ;
17851791 KeepWrite (req);
@@ -2266,6 +2272,7 @@ int Socket::OnInputEvent(void* user_data, uint32_t events,
22662272 bthread_attr_t attr = thread_attr;
22672273 attr.keytable_pool = p->_keytable_pool ;
22682274 attr.tag = bthread_self_tag ();
2275+ attr.set_name (" ProcessEvent" );
22692276 if (FLAGS_usercode_in_coroutine) {
22702277 ProcessEvent (p);
22712278#if BRPC_WITH_RDMA
0 commit comments