[Boost-bugs] [Boost C++ Libraries] #8599: enable_shared_from_this -- no throw alternative

Subject: [Boost-bugs] [Boost C++ Libraries] #8599: enable_shared_from_this -- no throw alternative
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-21 07:00:41


#8599: enable_shared_from_this -- no throw alternative
----------------------------------------------------------+-----------------
 Reporter: ingo.loehken@… | Owner: pdimov
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: smart_ptr
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: enable_shared_from_this, no throw, weak_this |
----------------------------------------------------------+-----------------
 I think that enable_shared_from_this misses one feature, that is
 accessible for weak_ptr and allows no throw access to the underlying
 instance to a shared_ptr, by either a valid pointer or a null_ptr
 (boost::weak_ptr::lock).

 It would be great to have such a mechanism for enable_shared_from_this as
 well -- i.e. returning the weak_ptr via member functions weak_this and
 then chain with lock -- to avoid bad_weak_ptr exception.

 Background:
 Combining intrusive container with enable_shared_from_this and auto-unlink
 option, where the element own the container, the only way to determine if
 an element is currently unlinking itself in muti threaded execution, is
 via an exception, rather than just checking for a null_ptr.

 Where this setup might sound very rare, it is one of the most powerful
 combinations of shared_ptr aliasing, intrusive-containers and
 enable_shared_from_this for perfect concurrent lookup containers.

 And under multi-threading conditions, the exception may get very common
 and therefore expensive.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8599>
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:13 UTC