28 #define TUPLE_SIZE 8 // arbitrary
29 typedef Tuple<int, TUPLE_SIZE> TupleClass;
32 class TupleContainingClass
35 TupleContainingClass()
51 int sanityCheckIndex = 0;
52 for (TupleClass::iterator iter = myTuple.begin();
53 iter < myTuple.end(); ++iter) {
54 if (sanityCheckIndex != *iter) {
69 static void share_tuple_to_threads(RCP<TupleContainingClass> shared_tuple,
70 std::atomic<int> & countErrors) {
71 while (!ThreadTestManager::s_bAllowThreadsToRun) {}
72 for(
int n = 0;
n < 1000; ++
n) {
73 if (!shared_tuple->readTheTuple()) {
100 std::atomic<int> countErrors(0);
102 for (
int testCycle = 0; testCycle < numTests; ++testCycle) {
103 std::vector<std::thread> threads;
106 RCP<TupleContainingClass> shared_tuple_rcp =
rcp(
107 new TupleContainingClass());
109 for (
int i = 0; i < numThreads; ++i) {
110 threads.push_back( std::thread(share_tuple_to_threads,
111 shared_tuple_rcp, std::ref(countErrors)) );
113 ThreadTestManager::s_bAllowThreadsToRun =
true;
114 for (
unsigned int i = 0; i < threads.size(); ++i) {
117 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.