private void AppThread() { Console.WriteLine("In AppThread"); if (m_Connector.Open(m_Params)) { CSubThread[] pts = new CSubThread[m_NumThreads]; for (int tid = 0; tid < m_NumThreads; tid++) { pts[tid] = new CSubThread(tid); pts[tid].Start(); } Console.WriteLine("Waiting for events, enter a string to exit the application."); Console.ReadLine(); m_Quit = true; bool toContinue = true; while (toContinue) { toContinue = false; for (int i = 0; i < m_NumThreads; i++) { toContinue = toContinue | pts[i].IsAlive(); } Thread.Sleep(100); } m_Connector.Close(); } Console.WriteLine("Exiting AppThread"); }