Runs in a thread; wakes up when there's a video frame to generate. When this wakes up, local copies of Params and Peeps will have been cached for us to use.
| 232 | // When this wakes up, local copies of Params and Peeps will have been |
| 233 | // cached for us to use. |
| 234 | void ImageWriter::saveFrameThread() |
| 235 | { |
| 236 | busy = false; // we're ready for business |
| 237 | std::cout << "Imagewriter thread started." << std::endl; |
| 238 | |
| 239 | while (true) { |
| 240 | // wait for job on queue |
| 241 | std::unique_lock<std::mutex> lck(mutex_); |
| 242 | condVar.wait(lck, [&]{ return dataReady && busy; }); |
| 243 | // save frame |
| 244 | dataReady = false; |
| 245 | busy = false; |
| 246 | |
| 247 | if (abortRequested) { |
| 248 | break; |
| 249 | } |
| 250 | |
| 251 | // save image frame |
| 252 | saveOneFrameImmed(imageWriter.data); |
| 253 | |
| 254 | //std::cout << "Image writer thread waiting..." << std::endl; |
| 255 | //std::this_thread::sleep_for(std::chrono::seconds(2)); |
| 256 | |
| 257 | } |
| 258 | std::cout << "Image writer thread exiting." << std::endl; |
| 259 | } |
| 260 | |
| 261 | } // end namespace BS |
nothing calls this directly
no test coverage detected