void GraphicsManager::unlockFrame() { Common::StackLock frameLock(_frameLockMutex); assert(_frameLock != 0); _frameLock--; }
bool LMRecorder::getCurrentFrame(GestureFrame &gestureFrame) { { MessageManagerLock mm (Thread::getCurrentThread()); if (! mm.lockWasGained()) return false; } ScopedLock frameLock(frameMutex); if (currentFrame != NULL) { gestureFrame = *currentFrame; return true; } return false; }
void LMRecorder::onFrame(const Leap::Controller& c) { ScopedLock frameLock(frameMutex); ScopedLock closingLock(closingMutex); if (currentFrame !=NULL) { delete currentFrame; currentFrame = NULL; } currentFrame = new GestureFrame(); clock_gettime(CLOCK_REALTIME, &t2); timestamp = (double)(t2.tv_sec - t1.tv_sec) + 1.e-9*(t2.tv_nsec - t1.tv_nsec); timestamp *= 1000; prepareData(c.frame(), currentFrame, timestamp); gestureStorageDriver->saveGestureFrame(*currentFrame); printf("F: %d T: %dms FPS: %.2f FPS_AVG: %.2f\n", count, (int)(timestamp), 1000.0/(timestamp-lastTime), 1000*count/timestamp); lastTime = timestamp; count++; notifyListeners(); }
void GraphicsManager::lockFrame() { Common::StackLock frameLock(_frameLockMutex); _frameLock++; }