This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Task Suspend and resume

Hi,
I writing a new app based on the new Keil 5 CMSIS-RTOS Version 1.02, I wanted to be able to suspend and resume a task, several times in another task,

I have used osThreadTerminate for suspending and I'm using osThreadCreate for resuming, But the problem with that is I'm making several copy Tasks!

Here is the code that I'm using


void enable_alarm(void)
{
        if(
        t_AlarmTask  = osThreadCreate(osThread(AlarmTask),  NULL);
}
void disable_alarm(void)
{
        osThreadTerminate(t_AlarmTask);
}


void FlasherTask (void const *argument)
{
while(1)
{
    disable_alarm();
    //Do some stuff
    enable_alarm();
    //Do some other things
    osDelay(1);
}
}


Do you have any Idea how I should suspend and resume?