chenBright commented on code in PR #2645: URL: https://github.com/apache/brpc/pull/2645#discussion_r1617125722
########## src/bthread/key.cpp: ########## @@ -204,14 +205,54 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTable { SubKeyTable* _subs[KEY_1STLEVEL_SIZE]; }; +class KeyTableList { +public: + KeyTableList() { + keytable = NULL; + } + ~KeyTableList() { + bthread::TaskGroup* const g = bthread::tls_task_group; + bthread::KeyTable* old_kt = bthread::tls_bls.keytable; + while (keytable) { + bthread::KeyTable* kt = keytable; + keytable = kt->next; + bthread::tls_bls.keytable = kt; + if (g) { + g->current_task()->local_storage.keytable = kt; + } Review Comment: delete kt后协程可能会被调度到其他worker上的话,每次使用g之前,得读一下bthread::tls_task_group吧? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org