inserted sched_yield() in the wait loop to reduce unwanted running.