Ardour  9.0-pre0-582-g084a23a80d
rcu_test.h
Go to the documentation of this file.
1 #include <string>
2 #include <pthread.h>
3 #include <cppunit/TestFixture.h>
4 #include <cppunit/extensions/HelperMacros.h>
5 
6 #include "pbd/rcu.h"
7 
8 class RCUTest : public CppUnit::TestFixture
9 {
13 
14 public:
15  RCUTest ();
16  void setUp ();
17  void race ();
18 
19  void read_thread ();
20  void write_thread ();
21 
22 private:
23  class Value {
24  public:
25  Value (std::string const& v)
26  : val (v)
27  {}
28  std::string val;
29  };
30 
31  typedef std::map<std::string, std::shared_ptr<Value> > Values;
32 
34 
35 #ifdef __APPLE__
36  pthread_mutex_t _mutex;
37  pthread_cond_t _cond;
38  size_t _cnt;
39 #else
40  pthread_barrier_t _barrier;
41 #endif
42 };
std::string val
Definition: rcu_test.h:28
Value(std::string const &v)
Definition: rcu_test.h:25
pthread_barrier_t _barrier
Definition: rcu_test.h:40
void setUp()
void read_thread()
std::map< std::string, std::shared_ptr< Value > > Values
Definition: rcu_test.h:31
void race()
SerializedRCUManager< Values > _values
Definition: rcu_test.h:33
void write_thread()
CPPUNIT_TEST(race)
CPPUNIT_TEST_SUITE_END()
CPPUNIT_TEST_SUITE(RCUTest)