public void Stop()
{
// Signal the shutdown event
_shutdownEvent.Set();
// Make sure to resume any paused threads
_pauseEvent.Set();
NotifyCaller("Stopped", OperationStatus.STOPPED);
if (_thread != null)
{
// Wait for the thread to exit
_thread.Join();
}
}