Github user pivotal-jbarrett commented on a diff in the pull request:

    https://github.com/apache/geode-native/pull/37#discussion_r103355539
  
    --- Diff: src/cppcache/src/statistics/AtomicStatisticsImpl.cpp ---
    @@ -330,7 +329,13 @@ double AtomicStatisticsImpl::_incDouble(int32_t 
offset, double delta) {
         throw IllegalArgumentException(s);
       }
     
    -  return (doubleStorage[offset] += delta);
    +  double expected = doubleStorage[offset];
    +  double value;
    +  do {
    +    value = expected + delta;
    +  } while (!doubleStorage[offset].compare_exchange_weak(expected, value));
    --- End diff --
    
    Yes. Some of the documentation for std::atomic suck out there and don't 
clearly state that expected is updated if the compare fails.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to