Hello everyone,
I tried to find the use for the ThreadId parameter and I dont find it anywhere. Why we would need to pass a ThreadId to the message queue?
Let's say I am using osWaitForever in my thread calling osMessageGet() and I want the kill the thread how to I unblock osMessageGet()? Is it where the parameter mentionned above come into play?
Regards,
Yes there is a timeout value in the command according to the webpage
osEvent osMessageGet ( osMessageQId queue_id, uint32_t millisec )
Parameters [in] queue_id message queue ID obtained with osMessageCreate. [in] millisec timeout value or 0 in case of no time-out. Returnsevent information that includes status code. NoteMUST REMAIN UNCHANGED: osMessageGet shall be consistent in every CMSIS-RTOS. Suspend the execution of the current RUNNING thread until a message arrives. When a message is already in the queue, the function returns instantly with the message information.
The argument millisec specifies how long the system waits for a message to become available. While the system waits the thread that is calling this function is put into the state WAITING. The millisec timeout value can have the following values: •when millisec is 0, the function returns instantly. •when millisec is set to osWaitForever the function will wait for an infinite time until a message arrives. •all other values specify a time in millisecond for a timeout.
www.keil.com/.../group___c_m_s_i_s___r_t_o_s___message.html
Hope this helps
Yes I knew that but I was looking a way to block the message pump when not needed to save the context switching of threads. This is part of a critical path in my application. Finally, I ended up add a flag in my message structure passed in parameter. I set this flag ON and send a message to this box for killing the message pump thread.
Thank you for your response .