trying to set scheduler mode only once and call yield either side of critical section