implement thread sleep instead of "busy waits"