Boost logo

Boost :

Subject: Re: [boost] [thread] terminating destructor
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2012-10-23 05:23:57


On Oct 21, 2012, at 2:28 AM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:

> Le 20/10/12 20:41, Andrzej Krzemienski a écrit :
>> 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).
> I agree that these classes are easy to write by the user. Maybe adding them as examples of use in the documentation could help the user.

I don't agree with the it's-easy-to-write-so-don't-add-it-to-Boost philosophy. By adding such a class to Boost, you highlight the idea to those that otherwise hadn't thought of it, and you standardize the I/F and semantics.

___
Rob


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk