#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(numThreads, syncBarrier); _channelWorker.push_back(worker); } OSG_ALWAYS<<"...done."<(_channelWorker.size());++i) { int status; //thread->addObserver(&observer); //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); //_channelWorker[i]->cancel(); // Seems to be wrong } //syncBarrier.block(numThreads); // Block until all threads are ready }