Re: [Boost-bugs] [Boost C++ Libraries] #7861: lockfree freelist doesn't destruct objects until its destructor is called

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7861: lockfree freelist doesn't destruct objects until its destructor is called
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-07 11:18:12


#7861: lockfree freelist doesn't destruct objects until its destructor is called
-----------------------------------+----------------------------------------
  Reporter: toffaletti@… | Owner: timblechmann
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: lockfree
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------+----------------------------------------

Comment (by anonymous):

 Replying to [comment:5 timblechmann]:
> a) check the michael/scott paper. in short: the content is copied before
 it is known to be valid. likewise the invalid objects can be destructed.

 I see, that makes sense. The value is copied before the CAS, but only used
 if the CAS succeeds, so if it had a non-trivial destructor or assignment
 it could be in some invalid state. I'm probably just getting lucky with
 std::shared_ptr since it is meant to be thread-safe.

 You probably can't sneak this into boost, but I think most types actually
 would work if you ignored the rules that C++ objects aren't relocatable
 because most are, see:

 github.com/facebook/folly/blob/master/folly/docs/FBVector.md#object-
 relocation

 Also what I said before was wrong, is_pod is too strict, and you want
 these:

 http://www.boost.org/doc/libs/1_52_0/libs/type_traits/doc/html/boost_typetraits/reference/has_trivial_copy.html
 http://www.boost.org/doc/libs/1_52_0/libs/type_traits/doc/html/boost_typetraits/reference/has_trivial_destructor.html

> b) the queue uses a dummy node, probably the item you see when the queue
 is destructed

 I considered that, but the default constructor for shared_ptr wouldn't
 create my LeakFinder object. If I modify the program to only put 1 item in
 the queue and then break on the constructor of LeakFinder in gdb, the only
 one created is the one I push to the queue.

> c) the freelist is also used by the stack, which does not have the
 requirements for assignment and destructor

 In any case I'm satisfied. Thanks for humoring me.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7861#comment:6>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC