Page 1 of 1

Message between thread and non-thread function

Posted: Mon Sep 25, 2023 11:27 pm
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

Re: Message between thread and non-thread function

Posted: Tue Sep 26, 2023 7:58 am
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