[LAD] easiest way to serialize messages for sending over a ringbuffer?

Iain Duncan iainduncanlists at gmail.com
Wed Dec 14 19:37:47 UTC 2011


>  > Thanks for the tips. What should one do if one detects a partial
> write? Is it best to have integrity checks on both ends of the ringbuffer?
>
> Avoid them.  There should be some calls for checkRingBufferWriteSpace(),
> make sure it is large enough to cater for your object size. You still have
> a few hoops and jumps to go through if the buffer is filling up but it is
> definitely going to be easier that catering for partial writes. Consider
> also logging messages when it is full and if it happens (too much or in my
> opinion at all) then look into why the reader is going too slow. If it is a
> general issue then you need to rearchitect what you are doing, if it is
> just a transient issue then bang more capacity on the ringbuffer.
>

Thanks Nick, so if I understand what you're saying, the producer should
check for sizeof(MyStruct) space before writing, and just delay writing
that message if there isn't enough space. I guess that's where I would log
that there a write failed then?

thanks
iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20111214/1640a743/attachment.html>


More information about the Linux-audio-dev mailing list