Move Thread.Sleep() inside the wait loop.