I have couple questions regarding setting signals to inactive threads using RTX and CMSIS. Please see the example code below:
osThreadId thread_id = osThreadCreate(osThread(thread_body), NULL); /* set thread active */
osThreadTerminate(thread_id); /* set thread inactive */
osSignalSet(thread_id, 1); /* set signal to inactive thread */
osThreadCreate(osThread(thread_body), NULL); /* set same thread active again */
void thread_body (void const * arg) { osSignalWait(1, 0); /* is the signal set? */ }
Questions: 1) The signal is set while the thread is inactive. What is the effect of this? 2) In the thread_body function, will the signal be set?
Thank you
I have found a complete and elegant solution to the problem of “waking up” a thread that can pend on several different os events - the CMSIS osWait function. If this function were used for pending, it would be simple to send an asynchronous “halt event” to a thread no matter what its pending on, even a timeout. The thread could then handle the event and any necessary cleanup. No terminating of threads required.
Only problem is, the CMSIS osWait function is optional and RTX doesn’t support it. Why doesn’t RTX support osWait? This seems like an extremely useful function. Can it be added?
Thanks,
Ben