progschj / ThreadPool

A simple C++11 Thread Pool implementation
zlib License
7.64k stars 2.21k forks source link

added getter for the number of workers and default constructor #9

Closed giacomodrago closed 10 years ago

giacomodrago commented 10 years ago

Non necessary features, but nice-to-have

progschj commented 10 years ago

Still thinking about this. The pool is intentionally minimal and mostly a basis to build more specialized ones. Or at least that was my original intention. I guess querying the size on the other hand is trivial enough that it might be reasonable. The hardware_concurrency thing should probably be max(1, hardware_concurrency). Before I put it on github I actually had that default constructor. The issue was that hardware_concurency is allowed to return 0 (which at the time was exactly what it did on my install). So I figured if the user wants hardware_concurrency as default he can pass it and it's the stdlibs fault if it goes wrong :) as opposed to the thread pools for having a non sane default.

giacomodrago commented 10 years ago

Thank you, I totally see your point. I'll fix the constructor in my fork. Congratulations for your excellent work!