altman08 commented on code in PR #3380:
URL: https://github.com/apache/brpc/pull/3380#discussion_r3567834470
##########
src/bthread/bthread.cpp:
##########
@@ -283,13 +282,14 @@ start_from_non_worker(bthread_t* __restrict tid,
// 1. NOSIGNAL is often for creating many bthreads in batch,
// inserting into the same TaskGroup maximizes the batch.
// 2. bthread_flush() needs to know which TaskGroup to flush.
- TaskGroup* g = tls_task_group_nosignal;
- if (NULL == g) {
+ auto g = BAIDU_GET_VOLATILE_THREAD_LOCAL(tls_task_group_nosignal);
+ if (NULL == g || g->tag() != tag) {
g = c->choose_one_group(tag);
- tls_task_group_nosignal = g;
+ BAIDU_SET_VOLATILE_THREAD_LOCAL(tls_task_group_nosignal, g);
}
return g->start_background<true>(tid, attr, fn, arg);
}
+ BAIDU_SET_VOLATILE_THREAD_LOCAL(tls_task_group_nosignal, NULL);
Review Comment:
CHECK_EQ(g->tag(), tag);
> Why add this?
I added CHECK_EQ(g->tag(), tag) and removed this line.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]