Github user pivotal-jbarrett commented on a diff in the pull request: https://github.com/apache/geode-native/pull/37#discussion_r103354398 --- Diff: src/cppcache/include/geode/CacheStatistics.hpp --- @@ -102,8 +102,8 @@ class CPPCACHE_EXPORT CacheStatistics : public SharedBase { virtual void setLastAccessedTime(uint32_t lat); virtual void setLastModifiedTime(uint32_t lmt); - volatile uint32_t m_lastAccessTime; - volatile uint32_t m_lastModifiedTime; + std::atomic<uint32_t> m_lastAccessTime; + std::atomic<uint32_t> m_lastModifiedTime; --- End diff -- The original code was using atomic operations already, just from multiple platform specific sources. std::atomic gets compiled into whatever is most performant for the platform. I would guess that this is actually faster than whatever we were doing on each platform since many were function calls into another library. This code will get compiled to atomic put opcodes on most platforms (with appropriate memory synchronization between caches).
--- 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. ---