Message between thread and non-thread function

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
pramod
Posts: 3
Joined: Wed Oct 12, 2022 12:49 pm

Message between thread and non-thread function

Post by pramod »

Hi everyone,

I'm newbie to rtos implementations, kindly help me out.

I'm implementing a mechanism to synchronously transfer data between a thread function and a non-thread function. I want to use the "synchronous messages" to achieve this.
Is it possible to send a message from a thread function to a non-thread function? If yes, what should be the thread pointer to chMsgSend()?
If it is not possible, what is the best way to achieve synchronous data transfer in this case?

Thankyou
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Message between thread and non-thread function

Post by Giovanni »

Hi,

There is no such thing like non-thread function in ChibiOS/RT, all code is executed by some thread. The functions you call from your main() are still executed in the context of the main thread.

Exceptions are ISRs, those are a special class and require the use of a dedicated API for synchronization with threads.

Giovanni
Post Reply