Implement chMsgSend, chMsgWait with timeout
Moderators: RoccoMarco, lbednarz, tfAteba
Implement chMsgSend, chMsgWait with timeout
Can ChibiOS support these function in the future? I tried to change "chSchGoSleepS" to "chSchGoSleepTimeoutS", But i don't know how to handle the message queue in timeout case.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Implement chMsgSend, chMsgWait with timeout
Hi,
Currently it is not planned. You may use mailboxes if you need timeouts.
Giovanni
Currently it is not planned. You may use mailboxes if you need timeouts.
Giovanni
Re: Implement chMsgSend, chMsgWait with timeout
Hi Giovanni
Thanks for the quick reply. I have tried the mailboxes. But in my case, i want to suspend the sending thread (with a timeout) when passing a message and release it when the job's done. Could you please give me some advice for this!
Thanks for the quick reply. I have tried the mailboxes. But in my case, i want to suspend the sending thread (with a timeout) when passing a message and release it when the job's done. Could you please give me some advice for this!
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Implement chMsgSend, chMsgWait with timeout
Hi,
You can use two mailboxes in the two directions one for messages, the other for answers, or a mailbox and an event source as answer.
Note that implementing timeouts on chMsgSend() is not possible because after waking up the receiving thread it is not more possible to withdraw the operation asynchronously because a timeout, there would be an inherent race condition: it is not possible to abort the send after that the message processing has begun.
Giovanni
You can use two mailboxes in the two directions one for messages, the other for answers, or a mailbox and an event source as answer.
Note that implementing timeouts on chMsgSend() is not possible because after waking up the receiving thread it is not more possible to withdraw the operation asynchronously because a timeout, there would be an inherent race condition: it is not possible to abort the send after that the message processing has begun.
Giovanni
Re: Implement chMsgSend, chMsgWait with timeout
Thank you for helping me. I will try two mailboxes.
PS: sorry for my poor English, it is not my native language
PS: sorry for my poor English, it is not my native language
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Implement chMsgSend, chMsgWait with timeout
lqv wrote:Thank you for helping me. I will try two mailboxes.
PS: sorry for my poor English, it is not my native language
Nor it is mine, so why bother