[Boost-bugs] [Boost C++ Libraries] #13309: function_address_holder::get_module/::get implementations are not thread-safe

Subject: [Boost-bugs] [Boost C++ Libraries] #13309: function_address_holder::get_module/::get implementations are not thread-safe
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-22 22:33:11


#13309: function_address_holder::get_module/::get implementations are not thread-
safe
------------------------------------------------+---------------------
 Reporter: Daniel Krügler <daniel.kruegler@…> | Owner: (none)
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: |
------------------------------------------------+---------------------
 The discussion in the git review
 https://github.com/boostorg/filesystem/pull/59#discussion_r152524074
 showed that the implementations of `function_address_holder::get_module`
 and `function_address_holder::get` are not completely atomic, because the
 loop conditions
 {{{
 for(unsigned i = 0; ModuleStates[id] < 2; ++i){
 }}}
 and
 {{{
 for(unsigned i = 0; FunctionStates[id] < 2; ++i){
 }}}
 are not using a read barrier for the variables `ModuleStates[id]` and
 `FunctionStates[id]`.

 It seems that proper thread-safety using interlocked operations could be
 realized by emulating an interlocked read-acquire operation via the
 `BOOST_INTERLOCKED_COMPARE_EXCHANGE(&N, 0, 0)` idiom.

 I can make a concrete pull request if agreement exists on the approach

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13309>
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-11-22 22:39:16 UTC