/// <summary> /// Stops back ground thread. /// </summary> private void stopBackgroundThread() { if (mBackgroundHandlerThread != null) { mBackgroundHandlerThread.quitSafely(); try { mBackgroundHandlerThread.join(); mBackgroundHandlerThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } if (mReaderHandlerThread != null) { mReaderHandlerThread.quitSafely(); try { mReaderHandlerThread.join(); mReaderHandlerThread = null; mReaderHandler = null; } catch (InterruptedException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } }