yanglimingcn opened a new issue, #2777: URL: https://github.com/apache/brpc/issues/2777
**Describe the bug (描述bug)** 最初提过一个butex_wake_*支持批量唤醒的功能,目的是为了减少锁唤醒的频率。之后又提交了一个给bRPC的worker线程池分组的功能。这bthread在不同分组里面访问共享资源做互斥的时候,使用批量唤醒的过程中就会产生bug,举例来说: 分组1,bthread1 和 分组2,bthread2共同访问一个互斥锁 mutex。 bthread1获得锁,bthread2在等待锁。bthread1使用完互斥锁要唤醒bthread2,但是bthread1如果使用批量唤醒,即使用bthread_flush来唤醒的时候就会有问题,因为bthread_flush运行在bthread1的上下文,所以它只能唤醒bthread1所在的分组1等待锁的bthread,不能唤醒其它分组等待锁的bthread。 现在想到的方案是: 在butex_wake_*的时候,会判断等待的bthread所在的分组,如果分组不是当前分组或者tls_task_group_nosignal,就直接唤醒这些bthread,也就是跨分组不支持批量唤醒。 **To Reproduce (复现方法)** **Expected behavior (期望行为)** 期望批量唤醒的功能正常。 **Versions (各种版本)** OS: Compiler: brpc: protobuf: **Additional context/screenshots (更多上下文/截图)** -- 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.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