[En-Nut-Discussion] reliability of message queues

Matthias Ringwald mringwal at inf.ethz.ch
Wed Feb 23 14:15:57 CET 2005


On 23.02.2005, at 12:43, Ole Reinhardt wrote:

>
> I'd like to have something like this:
>
> Start thread
> do something
> wait until connect event or error event (e.g. close down)
> while not error {
>   wait until data availabe event or error event
>   do something
> }

A fast but not to elegant implementation would use a combined 
DataAvailOrErrorQueue.
On data or error, the queue is signaled. If your get returns from the 
WaitEvent call,
you will have to check both: is there new data in the buffer and if an 
error occured.

this will work, it is just not so elegant.

An improvement to the current status could be to implement something 
along the posix select call
with or without the select mask. one could combine a queue and a 8 or 
16 bit bitvector into a select queue
struct and provide functions
like NutSelectPost(selectQueue, eventNr) and some to to the bit 
fiddeling.
  (maybe NutSelectWait( selectQueue, eventMask), NutSelectNext( 
selectQueue ) which gives back the next signaled event..)

thats for the options. I suggest the direct approach described above 
and starting defining a select-like API.


matthias




More information about the En-Nut-Discussion mailing list