Move Sleep implementation into helper.c and emulate sched_yield for Windows