In the Multi-Threaded model (with the IO Worker thread) removes the proxies from the IO Queue as needed, and the proxies may call their callbacks
| 330 | // In the Multi-Threaded model (with the IO Worker thread) |
| 331 | // removes the proxies from the IO Queue as needed, and the proxies may call their callbacks |
| 332 | unsigned CRefStreamEngine::FinalizeIOJobs(unsigned nFlags) |
| 333 | { |
| 334 | unsigned numFinalizedJobs = 0; |
| 335 | // we fetch the executed jobs one-by-one, and finalize them |
| 336 | // during finalization, the queue itself may be changed |
| 337 | |
| 338 | if (!IsCallbackTimeQuota(nFlags)) |
| 339 | return 0; |
| 340 | |
| 341 | AUTO_LOCK(m_csIOExecuted); |
| 342 | while (!m_queIOExecuted.empty()) |
| 343 | { |
| 344 | CRefReadStreamProxy_AutoPtr pProxy = m_queIOExecuted.front(); |
| 345 | m_queIOExecuted.pop_front(); |
| 346 | // to avoid locking the whole array during execution of the callbacks: |
| 347 | AUTO_UNLOCK(m_csIOExecuted); |
| 348 | |
| 349 | assert(pProxy->IsIOExecuted()); |
| 350 | |
| 351 | int64 nStartTime, nEndTime; |
| 352 | QueryPerformanceCounter ((LARGE_INTEGER*)&nStartTime); |
| 353 | // TODO: add control over the callback execution time |
| 354 | // this proxy needs to be moved out of the IO queue |
| 355 | pProxy->FinalizeIO (); |
| 356 | ++numFinalizedJobs; |
| 357 | QueryPerformanceCounter((LARGE_INTEGER*)&nEndTime); |
| 358 | |
| 359 | m_nCallbackTimeQuota -= nEndTime - nStartTime; |
| 360 | |
| 361 | if (!IsCallbackTimeQuota(nFlags)) |
| 362 | break; |
| 363 | } |
| 364 | |
| 365 | return numFinalizedJobs; |
| 366 | } |
| 367 | |
| 368 | |
| 369 | // this will be the thread that executes everything that can take time |
nothing calls this directly
no test coverage detected