|
Boost : |
Subject: Re: [boost] [thread] terminating destructor
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2012-10-20 14:41:03
2012/10/20 Vicente J. Botet Escriba <vicente.botet_at_[hidden]>
What do you think of adding a thread_guard class that could interrupt and
> join on the destructor?
>
By "adding", do you mean adding it to Boost? I suggested this interruption
because I believed (apparently incorrectly) that class thread represents a
tool ready to be used by "end-user" programmers. After this discussion I
realize that thread is a low-level primitive that you use for building
high-level concurrency constructs, but would rather not use it directly.
Following this view, anyone can build their own abstraction atop
boost::thread. I do not think the above thread_guard should be added into
Boost. If I need it I can write it myself (and I would probably write it
differently; e.g. using variadic forwarding constructor). Someone else may
introduce another wrapper that detaches in destructor.
Would something like these simple classes respond to your needs?
Actually, it was no particular need that raised my proposal; I just thought
(now I do not anymore) it was a generally good idea for a general purpose
tool.
Regards,
&rzej
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk