Change Thread.Sleep to AutoResetEvent