[ https://issues.apache.org/jira/browse/GEODE-2531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15886996#comment-15886996 ]
ASF GitHub Bot commented on GEODE-2531: --------------------------------------- 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. > Replace HostAsm::atomic* and AtomicInc with std::atomic > ------------------------------------------------------- > > Key: GEODE-2531 > URL: https://issues.apache.org/jira/browse/GEODE-2531 > Project: Geode > Issue Type: Sub-task > Components: native client > Reporter: Jacob S. Barrett > Assignee: Jacob S. Barrett > > Replace {{HostAsm::atomic*}} and {{AtomicInc}} with > {{[std::atomic|http://en.cppreference.com/w/cpp/atomic/atomic]}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)