cocoOS can manage this for you. When idle, the scheduler checks for any task waiting for execution. If no task wants to run, a call is made to os_cbkSleep() where you could put your sleep instruction. For time keeping the MCU must wake up every tick to adjust task timers.