Message between thread and non-thread function

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

Message between thread and non-thread function

Postby pramod » Mon Sep 25, 2023 11:27 pm

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: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Message between thread and non-thread function

Postby Giovanni » Tue Sep 26, 2023 7:58 am

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


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 5 guests