
Le 26/10/12 09:53, Andrzej Krzemienski a écrit :
2012/10/25 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
I've been working a little bit these classes and I have not find that interrupt-and-join on the destructor could be a a good compromise. As others, maybe you, have signaled, each developer could need a specific action on the destruction. As always been more generic means making the class parameterized with a policy.
Does this respond to your question?
It definitely does! Just one suggestion, wouldn't it be better if the policy was only required to be callable with the argument of type thread& ? I.g.:
struct strict_thread_joiner { void operator()( thread& t ) const { if (t.joinable()) { t.join(); } } };
Yeah, this would be much more simple. I will need that the policy is stateless to avoid the moving issues for thread_joiner. Best, Vicente