test interprocess concurrency (#258)

* added cfoa_interprocess_concurrency_tests

* avoided C++14 digit separators

* stopped using exit codes to pass numerical info to parent

* Reorder includes to make msvc-14.0 happy

* made cumulative_stats interprocess concurrency safe

* disabled interprocess_concurrency_tests for Clang 3.5-8
(Boost.Process compile error)

* made test names shorter for the benefit of MINGW32

---------

Co-authored-by: Peter Dimov <pdimov@gmail.com>
This commit is contained in:
joaquintides
2024-06-22 09:13:30 +02:00
committed by GitHub
parent a166a56401
commit e3818afd45
5 changed files with 146 additions and 7 deletions

View File

@@ -41,7 +41,7 @@
#include <utility>
#if defined(BOOST_UNORDERED_ENABLE_STATS)
#include <boost/unordered/detail/cumulative_stats.hpp>
#include <boost/unordered/detail/foa/cumulative_stats.hpp>
#endif
#if !defined(BOOST_UNORDERED_DISABLE_SSE2)

View File

@@ -6,8 +6,8 @@
* See https://www.boost.org/libs/unordered for library home page.
*/
#ifndef BOOST_UNORDERED_DETAIL_CUMULATIVE_STATS_HPP
#define BOOST_UNORDERED_DETAIL_CUMULATIVE_STATS_HPP
#ifndef BOOST_UNORDERED_DETAIL_FOA_CUMULATIVE_STATS_HPP
#define BOOST_UNORDERED_DETAIL_FOA_CUMULATIVE_STATS_HPP
#include <array>
#include <boost/config.hpp>
@@ -16,12 +16,14 @@
#include <cstddef>
#if defined(BOOST_HAS_THREADS)
#include <boost/unordered/detail/foa/rw_spinlock.hpp>
#include <mutex>
#endif
namespace boost{
namespace unordered{
namespace detail{
namespace foa{
/* Cumulative one-pass calculation of the average, variance and deviation of
* running sequences.
@@ -117,7 +119,7 @@ template<std::size_t N>
class concurrent_cumulative_stats:cumulative_stats<N>
{
using super=cumulative_stats<N>;
using lock_guard=std::lock_guard<std::mutex>;
using lock_guard=std::lock_guard<rw_spinlock>;
public:
using summary=typename super::summary;
@@ -157,7 +159,7 @@ public:
private:
concurrent_cumulative_stats(const super& x,lock_guard&&):super{x}{}
mutable std::mutex mut;
mutable rw_spinlock mut;
};
#else
@@ -167,6 +169,7 @@ using concurrent_cumulative_stats=cumulative_stats<N>;
#endif
} /* namespace foa */
} /* namespace detail */
} /* namespace unordered */
} /* namespace boost */