We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
“往线程池添加任务会增加任务队列的竞争,lock-free 队列可以避免这点但存在乒乓缓存的问题。为此需要把任务队列拆分为线程独立的本地队列和全局队列,当线程队列无任务时就去全局队列取任务”
在这一小节中,submit函数中的local_queue永远是nullptr,原因如下: local_queue指针在worker_thread中赋值,woker_thread运行在子线程,而submit函数是在main线程中调用的,二者不是在同一线程,所以二者的local_queue根本不是同一个。
所以这段代码无法达到想要的目的。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
“往线程池添加任务会增加任务队列的竞争,lock-free 队列可以避免这点但存在乒乓缓存的问题。为此需要把任务队列拆分为线程独立的本地队列和全局队列,当线程队列无任务时就去全局队列取任务”
在这一小节中,submit函数中的local_queue永远是nullptr,原因如下:
local_queue指针在worker_thread中赋值,woker_thread运行在子线程,而submit函数是在main线程中调用的,二者不是在同一线程,所以二者的local_queue根本不是同一个。
所以这段代码无法达到想要的目的。
The text was updated successfully, but these errors were encountered: