Eliminate busy waiting

Replaced 'busy waiting' in timer_sleep() function with a semaphore self-blocking method.  See design document for more information.