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

How to wait on multiple objects in CMSIS-RTOS?

Hello.

I have a thread which must be waked-up from multiple sources - 3 different message box for example. How I can organize this in CMSIS-RTOS? Currently in revision 4.00 of CMSIS, there is a osWait() function. But in RTX 4.74 (which comes with latest CMSIS), this function is not implemented.

So what I can do like a workaround of this problem? Wake-up regularly via timer and check all message boxes? Working but not efficient.Currently the only multi-object wake-up source implemented in CMSIS-RTOS seems to be the signals. But it's not really cool to use message box and signals in parallel for waking up. Did I'm missing something?

Parents
  • I am in a similar situation where I need to send a signal (from multiple IRQ) to a single task. After reading the API and going through examples I don't think that there is any elegant way of doing this.

    A task can just wait for a single signal.

    I noticed that there used to be a function called osSignalGet which has now being taken out. This would actually solve the problem.

    So I can do something like this:

    <code>

    for(;;){
         osSignalWait(0,osWaitForever); // wait for any signal, sent from a multiple sourcse of IRQ;
         currentSignal = osSignalGet(currentThread); //not sure the exact syntax, but this returns the current signal
         switch(currentSignal){
              case BUTTON1:
              ....
               break;
              ...
              ...
          }
    }
    

    </code>

    Thomas, not sure I follow 100% of your alternate implementation. Are you suggesting that if we have 10 IRQs then we should have 10 different tasks to receive (one each). Then from there send messages etc after that?

    I am quite stuck with this at the moment. Any suggestions / tips would be great. !

Reply
  • I am in a similar situation where I need to send a signal (from multiple IRQ) to a single task. After reading the API and going through examples I don't think that there is any elegant way of doing this.

    A task can just wait for a single signal.

    I noticed that there used to be a function called osSignalGet which has now being taken out. This would actually solve the problem.

    So I can do something like this:

    <code>

    for(;;){
         osSignalWait(0,osWaitForever); // wait for any signal, sent from a multiple sourcse of IRQ;
         currentSignal = osSignalGet(currentThread); //not sure the exact syntax, but this returns the current signal
         switch(currentSignal){
              case BUTTON1:
              ....
               break;
              ...
              ...
          }
    }
    

    </code>

    Thomas, not sure I follow 100% of your alternate implementation. Are you suggesting that if we have 10 IRQs then we should have 10 different tasks to receive (one each). Then from there send messages etc after that?

    I am quite stuck with this at the moment. Any suggestions / tips would be great. !

Children