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);
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
#define TEUCHOS_THREAD_SAFE_UNIT_TESTS_THREADS_USED
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Statically sized simple array (tuple) class.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
Simple macro that catches and reports standard exceptions and other exceptions.
Smart reference counting pointer class for automatic garbage collection.