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

about Semaphores

Hi ,

I am checking the page34 of«rl-arm_gs» and find below description :

Signaling
Synchronizing the execution of two tasks is the simplest use of a semaphore:

os_sem semB;
__task void task1 (void) {
os_sem_init (semB, 0);
while (1) {
os_sem_send (semB);
FuncA();
}
}
__task void task2 (void) {
while (1) {
os_sem_wait (semB, 0xFFFF);
FuncB();
}
}


In this case, the semaphore is used to ensure that the code in FuncA() is executed
before the code in FuncB().

My questions is,

when the task1 will be suspended and the scheduler will start task2? I add above codes into one keil project and find actually task2 will not start for ever.

I think that such description above in italics is incorrect, isn't it?

Parents Reply Children
No data