apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

execution_queue_join安全吗? #2775

Closed zergvszerg closed 1 month ago

zergvszerg commented 1 month ago

使用场景是先execution_queue_stop再间隔不定时间execution_queue_join, 但考虑到resource pool会归还使用完的资源, ExecutionQueueId可能会被复用, 那么execution_queue_join就可能等待在一个还没有execution_queue_stop的execution queue上, 从而不安全, 请问有什么好的解决方法?

chenBright commented 1 month ago

ExecutionQueueId是是带版本号的(类似bthread_t),归还之后的资源的版本号已经变了,所以execution_queue_join是安全的,不会等其他execution_queue。