Re: [Boost-bugs] [Boost C++ Libraries] #9357: Request for queue::size_unsafe()

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9357: Request for queue::size_unsafe()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-09 10:26:07


#9357: Request for queue::size_unsafe()
--------------------------------------+--------------------------
  Reporter: ClaytonGDavis@… | Owner: timblechmann
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: lockfree
   Version: Boost Development Trunk | Severity: Cosmetic
Resolution: | Keywords:
--------------------------------------+--------------------------

Comment (by timblechmann):

 tbo, i think it would be safer to embed an atomic counter in the user
 code, mainly because of the following reasons

 * size() cannot be accurate: the container might be changed from another
 thread before the result is used
 * inaccurately changing the size, there are two possibility: either
 increment the counter before pushing/after popping or after popping/before
 pushing. which one should be used?

 in order to keep the interface most robust, i think it is best to defer
 these design decisions to the user code.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9357#comment:1>
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:14 UTC