public void Join() { int lastReportedSize = int.MaxValue; while (true) { lock (m_itemsRemaining) { if (m_itemsRemaining[0] == 0) { break; } if ((lastReportedSize - m_itemsRemaining[0]) > 10) { Log.Progress("Finishing DeepZoom conversions ({0} remaining)", m_itemsRemaining[0]); lastReportedSize = m_itemsRemaining[0]; } Monitor.Wait(m_itemsRemaining); } } m_stopRequested = true; lock (m_workQueue) { Monitor.PulseAll(m_workQueue); } lock (m_threadPool) { lastReportedSize = int.MaxValue; while (m_threadPool.Count > 0) { if ((lastReportedSize - m_threadPool.Count) > 10) { Log.Progress("Stopping threads ({0} remaining)", m_threadPool.Count); lastReportedSize = m_threadPool.Count; } Monitor.Wait(m_threadPool); } } DZ.CollectionCreator collectionCreator = new DZ.CollectionCreator(); collectionCreator.Create(m_dziPaths, m_dzcPath); m_working = false; m_threadPool.Clear(); m_dziPaths.Clear(); m_workQueue.Clear(); m_stopRequested = false; m_itemsRemaining[0] = 0; }
public void Join() { int lastReportedSize = int.MaxValue; while (true) { lock (m_itemsRemaining) { if (m_itemsRemaining[0] == 0) break; if ((lastReportedSize - m_itemsRemaining[0]) > 10) { Log.Progress("Finishing DeepZoom conversions ({0} remaining)", m_itemsRemaining[0]); lastReportedSize = m_itemsRemaining[0]; } Monitor.Wait(m_itemsRemaining); } } m_stopRequested = true; lock (m_workQueue) { Monitor.PulseAll(m_workQueue); } lock (m_threadPool) { lastReportedSize = int.MaxValue; while (m_threadPool.Count > 0) { if ((lastReportedSize - m_threadPool.Count) > 10) { Log.Progress("Stopping threads ({0} remaining)", m_threadPool.Count); lastReportedSize = m_threadPool.Count; } Monitor.Wait(m_threadPool); } } DZ.CollectionCreator collectionCreator = new DZ.CollectionCreator(); collectionCreator.Create(m_dziPaths, m_dzcPath); m_working = false; m_threadPool.Clear(); m_dziPaths.Clear(); m_workQueue.Clear(); m_stopRequested = false; m_itemsRemaining[0] = 0; }