void Workspace::WaitforContinue() { #if !defined(BEHAVIAC_RELEASE) while (!HandleRequests()) { behaviac::Thread::Sleep(200); } #endif//BEHAVIAC_RELEASE }
//////////////////////////////////////////////////////////////////////////////// // Main function for device thread void CameraV4L2::Main() { struct timeval time; long sumTime=0; int fpsFrames = 0; struct timeval timePrev; GlobalTime->GetTime(&timePrev); int frameno; frameno = 0; while (true) { // Go to sleep for a while (this is a polling loop). //usleep(50000); // Test if we are supposed to cancel this thread. pthread_testcancel(); // Process any pending requests. HandleRequests(); // Get the time GlobalTime->GetTime(&time); sumTime += (time.tv_sec-timePrev.tv_sec)*1000000 + (time.tv_usec-timePrev.tv_usec); timePrev = time; fpsFrames++; if (sumTime > 2000000){ if (showFPS>=0) PLAYER_MSG2(showFPS, "Fps: %f (%d)", 1000000.0*fpsFrames/sumTime, fpsFrames); sumTime = 0; fpsFrames = 0; } if (sumTime<0){ sumTime = 0; fpsFrames = 0; } this->tsec = time.tv_sec; this->tusec = time.tv_usec; //printf("Time between // Write data to server this->WriteData(); frameno++; } }