private void CancelSyncThread () { Thread thread = sync_thread; lock (sync_mutex) { if (sync_thread != null && sync_thread_wait != null) { sync_thread_dispose = true; sync_thread_wait.Set (); } } if (thread != null) { thread.Join (); } }