#include "SimHost.h" #include #include #include // System includes #include #ifdef _WIN32 #include #define getpid() _getpid() #else #include #endif // App includes SimHost::SimHost() { OSG_ALWAYS<<"SimHost instantiated."< worker = new ChannelWorker(); _channelWorker.push_back(worker); } OSG_ALWAYS<<"...done."<(_channelWorker.size());++i) { int status; //thread->setStackSize(1024*256); status = _channelWorker[i]->start(); assert(status == 0); } // Do something in the main thread for(int i=0;i<10000000;i++) OSG_ALWAYS<<""; // Signal threads to finish for(int i=0;i(_channelWorker.size());++i) { //_channelWorker[i]->setDone(true); // non blocking _channelWorker[i]->cancel(); // Blocking } for(int i=0;i<100000000;i++) OSG_ALWAYS<<""; //syncBarrier.block(numThreads); // Block until all threads are ready }