///////////////////////////////////////////////////////////////////// MT: Main thread only
| 59 | ////////////////////////////////////////////////////////////////////////// |
| 60 | // MT: Main thread only |
| 61 | CRefStreamEngine::~CRefStreamEngine() |
| 62 | { |
| 63 | StopWorkerThread(); |
| 64 | |
| 65 | m_setLockedStreams.clear(); |
| 66 | |
| 67 | // fail all outstanding requests |
| 68 | // we don't need to lock, since there's already no worker thread at this moment |
| 69 | while (!m_queIOJobs.empty()) |
| 70 | { |
| 71 | CRefReadStreamProxy_AutoPtr pJob = m_queIOJobs.front(); |
| 72 | m_queIOJobs.pop_front(); |
| 73 | pJob->OnFinishRead(ERROR_ABORTED_ON_SHUTDOWN); // aborted |
| 74 | } |
| 75 | |
| 76 | // finalize all the jobs that can be finalized |
| 77 | while (!m_queIOExecuted.empty() && FinalizeIOJobs(FLAGS_DISABLE_CALLBACK_TIME_QUOTA) > 0) |
| 78 | continue; |
| 79 | |
| 80 | // if we still have some streams, that's because someone didn't release the proxy |
| 81 | if (m_pLog) |
| 82 | for (NameStreamMap::iterator it = m_mapFilesByName.begin(); it != m_mapFilesByName.end(); ++it) |
| 83 | m_pLog->Log("%s: %s", it->first.c_str(), it->second->Dump().c_str()); |
| 84 | |
| 85 | CloseHandle (m_hIOJob); |
| 86 | CloseHandle (m_hIOExecuted); |
| 87 | CloseHandle (m_hDummyEvent); |
| 88 | } |
| 89 | |
| 90 | unsigned CRefStreamEngine::UpdateAndWait (unsigned nMilliseconds, unsigned nFlags) |
| 91 | { |