62 #define TUPLE_SIZE 8 // arbitrary
63 typedef Tuple<int, TUPLE_SIZE> TupleClass;
66 class TupleContainingClass
69 TupleContainingClass()
85 int sanityCheckIndex = 0;
86 for (TupleClass::iterator iter = myTuple.begin();
87 iter < myTuple.end(); ++iter) {
88 if (sanityCheckIndex != *iter) {
103 static void share_tuple_to_threads(RCP<TupleContainingClass> shared_tuple,
104 std::atomic<int> & countErrors) {
105 while (!ThreadTestManager::s_bAllowThreadsToRun) {}
106 for(
int n = 0;
n < 1000; ++
n) {
107 if (!shared_tuple->readTheTuple()) {
134 std::atomic<int> countErrors(0);
136 for (
int testCycle = 0; testCycle < numTests; ++testCycle) {
137 std::vector<std::thread> threads;
140 RCP<TupleContainingClass> shared_tuple_rcp =
rcp(
141 new TupleContainingClass());
143 for (
int i = 0; i < numThreads; ++i) {
144 threads.push_back( std::thread(share_tuple_to_threads,
145 shared_tuple_rcp, std::ref(countErrors)) );
147 ThreadTestManager::s_bAllowThreadsToRun =
true;
148 for (
unsigned int i = 0; i < threads.size(); ++i) {
151 convenience_log_progress(testCycle, numTests);