Closed ldionne closed 6 years ago
I don't like thread_group class. IIRC I deprecated it, but maybe I'm wrong. What is missing with a vector of threads. What make threads different that need a specific container?
I don't think it's deprecated in the documentation. Thanks for your comment; I moved away from using thread_group
. I must agree it does not have much more beyond a straight std::vector<boost::thread>
.
If you're not going to improve the class and if you think it does not buy much over std::vector
, I would suggest deprecating it in the documentation to make it clear that users are discouraged from using it. Otherwise (and especially since it's marked as experimental), users may think that it's something that will be expanded in the future and even possibly proposed for standardization.
I don't think the standard will be interested by a thread_group. But if you believe it is worth improving it, I would accept a PR.
What I'm proposing is to mark it as deprecated.
boost::thread_group
could provide a constructor taking a number and a function object:This is especially useful when mixing threads and something like Boost.ASIO with an
io_service
, or when using Fibers. In that case, the function being run in all the threads is the same, so it makes sense to use a constructor like this.Another possibility would be to provide an iterator-based constructor (iterators to callables):
I don't have a use-case for the latter, but I do have one for the former. I can submit a PR if there's interest for any of this.