void AtomicTest( void ) { char ender; cout << "Starting Loki::Printf AtomicTest" << endl; { ThreadPool pool; pool.Create( 20, &DoLokiPrintfLoop ); pool.Start(); pool.Join(); } cout << "Finished Loki::Printf AtomicTest." << endl; cout << "If the output lines up in neat columns, the test passed." << endl; cout << "If the output is not in columns, then the test failed." << endl; cout << "Press <Enter> key to continue. "; cin.get( ender ); cout << "Starting Loki::FPrintf AtomicTest" << endl; { ThreadPool pool; pool.Create( 20, &DoLokiFPrintfLoop ); pool.Start(); pool.Join(); } cout << "Finished Loki::FPrintf AtomicTest." << endl; cout << "If the output lines up in neat columns, the test passed." << endl; cout << "If the output is not in columns, then the test failed." << endl; cout << "Press <Enter> key to continue. "; cin.get( ender ); cout << "Starting stdout AtomicTest" << endl; { ThreadPool pool; pool.Create( 20, &DoStdOutLoop ); pool.Start(); pool.Join(); } cout << "Finished stdout AtomicTest." << endl; cout << "If the output lines up in neat columns, your compiler implements printf correctly." << endl; cout << "If the output is not in columns, then your compiler implements printf incorrectly." << endl; cout << "Press <Enter> key to continue. "; cin.get( ender ); cout << "Starting cout AtomicTest" << endl; { ThreadPool pool; pool.Create( 20, &DoCoutLoop ); pool.Start(); pool.Join(); } cout << "Finished cout AtomicTest." << endl; cout << "If the output lines up in neat columns, your compiler implements cout correctly." << endl; cout << "If the output is not in columns, then your compiler implements cout incorrectly." << endl; cout << "Press <Enter> key to continue. "; cin.get( ender ); }
void DoObjectLockTest( void ) { cout << "Starting DoObjectLockTest" << endl; LockableObjects & objects = GetLockableObjects(); objects.reserve( ObjectCount ); for ( unsigned int ii = 0; ii < ObjectCount; ++ii ) { LockableObject * object = new LockableObject( ii ); objects.push_back( object ); } { ThreadPool pool; pool.Create( ThreadCount, &RunObjectTest ); pool.Start(); pool.Join(); } unsigned int totalFails = 0; for ( unsigned int ii = 0; ii < ThreadCount; ++ii ) { const unsigned int failCount = FailCounts[ ii ]; ::Loki::Printf( "Thread: [%u] Failures: [%u]\n" )( ii )( failCount ); totalFails += failCount; } const char * result = ( 0 == totalFails ) ? "Passed" : "FAILED"; cout << "Finished DoObjectLockTest. Total Fails: " << totalFails << " Result: " << result << endl; }
int main(int argc, char * argv[]) { printf("starting: %u\n", 4); ThreadPool<4> p; p.Create(thread_start, 0); ;;; ////// p.WaitForTerminate(); exit(EXIT_SUCCESS); }
void DoClassLockTest( void ) { cout << "Starting DoClassLockTest" << endl; LockableClasses & objects = GetLockableClasses(); objects.reserve( ClassCount ); for ( unsigned int ii = 0; ii < ClassCount; ++ii ) { LockableClass * object = new LockableClass( ii ); objects.push_back( object ); } { ThreadPool pool; pool.Create( ThreadCount, &RunClassTest ); pool.Start(); pool.Join(); } cout << "Finished DoClassLockTest" << endl; }