Hi,
I'm writing a socket oriented layer over tcp net using RTX . I need to redirect socket events to the good task for the good socket. I use together mailboxes and events : the OR / END triggering possibility of events and the message content of a mailbox to get information on a particular sockets . But if the event is not for the waiting socket I need to 'reinject ' the data in the mailbox ....
Could it be possible to add a function in the RTX library to peek a mailbox without getting out the message ?
I think the latest version of freertos has this function .
I don't think peeking would work.
The same moment the thread tries to go to sleep after deciding that the data in the mailbox wrong, it would be activated again since there is data in the mailbox.
You should create a data router that picks up the data and distribute it into different mailboxes depending on which thread that should consume the data.
tha data router is the simplest , but if you have 8 sockets with 10 tasks , you have to use 8 * 10 mailboxes !
This tcpnet stack is a real pain to use with RTX ... If keil designed a bsd socket oriented with select() it coud be simple :)
Isn't it enough with 10 mailboxes - one for each thread, and you post enough information for the thread to know which socket and event the mail represent?
In this case , I guess you can have several event messages from different sockets in the mailbox of a thread.
What are you doing if you're waiting a event for socket 1 in thread A and there's a event message from socket 2 in the mailbox ? It's the same trouble :/