Skip to content
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

Threadpool章节部分在测试时,异步线程数量大于开辟的数量(书中默认为2) #47

Open
henanwg opened this issue May 16, 2022 · 1 comment

Comments

@henanwg
Copy link

henanwg commented May 16, 2022

image

image

书中显示:用于处理任务的异步线程的数量只有两个。我现在测试的情况与书中不符。
我使用的测试工程见附件

untitled.zip

@henanwg
Copy link
Author

henanwg commented May 16, 2022

cao,明白啥问题了。ThreadPool类在实例化的时候直接创建了std::thread::hardware_concurrency()个异步线程。再加上在main函数中pool.Start(2)部分新增的两个线程,一共就有6(我是六核cpu)+2=8个线程了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant