void ofxMtJsonParser::threadedFunction(){ #if( OF_VERSION_MINOR <= 9 ) try { getPocoThread().setName("ofxMtJsonParser"); getPocoThread().setOSPriority(Poco::Thread::getMinOSPriority()); } catch (Poco::SystemException exc) { ofLogError("ofxMtJsonParser") << exc.what() << " " << exc.message() << " " << exc.displayText(); } #else setThreadName("ofxMtJsonParser"); #endif switch (state) { case CHECKING_JSON: checkLocalJsonAndSplitWorkload(); ofSleepMillis(16); break; case MERGE_THREAD_RESULTS: mergeThreadResults(); ofSleepMillis(16); break; default: break; } }
void testApp::threadedFunction(){ getPocoThread().setName("MyLoopingThread"); while(isThreadRunning()){ TS_START("task"); ofSleepMillis(30); TS_START("subtask1"); ofSleepMillis(300); TS_STOP("subtask1"); TS_STOP("task"); ofSleepMillis(100); } }
//------------------------------------------------- bool ofThread::isCurrentThread() const{ return ofThread::getCurrentPocoThread() == &getPocoThread(); }