-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modify bthread attribute with tag #2476
Conversation
@wwbmmm 我觉得brpc内部启动的协程,有些地方需要把bthread_tag设置正确,否则会存在跨线程池执行的问题,特别是socket.cpp这块。 |
4d7114a
to
e170408
Compare
类似BTHREAD_ATTR_NORMAL这些,能不能默认都设置成在本线程池执行?比如把tag的初始值设置成一个特殊值,表示在本线程池执行。因为BTHREAD_ATTR_NORMAL这些不只是在brpc框架会用,业务代码也会用到 |
e170408
to
55d7ef2
Compare
我这边加了一个BTHREAD_TAG_INVALID,是BTHREAD_ATTR_NORMAL这些的默认值,如果用户启动的协程用了这些的话,会在默认的local线程池中执行。 这么改之后,brpc内部的有些地方感觉也不需要改了 |
430bdb2
to
b4d2f99
Compare
b4d2f99
to
9db7f2c
Compare
LGTM |
拆分线程池后,有些原来服务于一个线程池的routine现在服务于多个线程池,如果这个routine内部有bthread锁,就会发生问题,因为线程池之间不能被唤醒。另外就是跨线程池创建协程,使用了bthread锁。 |
线程池之间,能否支持唤醒呢?就像之前 pthread和bthread 也可以相互唤醒,可能需要调整下butex的相关逻辑 |
我感觉线程池之间不需要这么做了,如果线程池之间有共享的内容,就退化到pthread_mutex就可以了。 |
What problem does this PR solve?
Issue Number:
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects(性能影响):
Breaking backward compatibility(向后兼容性):
Check List: