public void SignalToStop() { // stop thread if (thread != null) { stop = true; for (int i = 0; i < notifications.Length; i++) (notifications[i].WaitHandle as AutoResetEvent).Set(); } }