void OpenJpegDecoder::Work() { while (ShouldRun()) { WaitForRequests(); DecodeRequestPtr request = GetNextRequest<DecodeRequest>(); if (request) { // Wait if "too many" results already produced, to prevent slowing down the main thread with // too many texture creations per frame Foundation::ThreadTaskManager* manager = GetThreadTaskManager(); if (manager) { for (;;) { uint results = manager->GetNumResults(GetTaskDescription()); if (results < decodes_per_frame_) break; if (!ShouldRun()) return; boost::this_thread::sleep(boost::posix_time::milliseconds(20)); } } { PROFILE(OpenJpegDecoder_Decode); PerformDecode(request); } } RESETPROFILER } }
void VorbisDecoder::Work() { while (ShouldRun()) { WaitForRequests(); VorbisDecodeRequestPtr request = GetNextRequest<VorbisDecodeRequest>(); if (request) { { PROFILE(VorbisDecoder_Decode); PerformDecode(request); } } RESETPROFILER } }