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?
I have used osThreadTerminate for suspending and I'm using osThreadCreate for resuming,
And by what line of reasoning did you arrive at the conclusion that the obvious names of the functions for suspend and resume would be "terminate" and "create" instead of, hmmm, let's see, ..., "suspend" and "resume"?
What made you assume that suspending a task is even possible in this RTOS?
Thanks for the info, Suspending and resuming are two critical needed functions that are not existed on the CIMCIS RTOS, I think they have over simplified the things! They really wanted the kids to be able to use it! but at what cost?
So do we have any ticks in here to implement them? or Am I totally missing something!!!
If the scheduler can't suspend and resume then it's up to you to implement cooperative suspend.
Ok, I will take the responsibility,But how I should implement it? any hints?
The running thread obviously have too cooperate and look at something to know when it should suspend. And then it's business as usual to just wait for an event to know when it can resume again.
The only issue is that the thread can only suspend and resume at fixed points in the code.
If you find that the "CIMCIS RTOS" is not suitable for your requirements, find another one which is!
You did check the specifications before using it, didn't you...?
You should take a look at "osWait" function to "suspend" the task and "osSignalSet" to "resume" the task.
Dear UG Thanks for the info, It's exactly my answer.