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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <iainduncanlists@...>
Cc: <linux-audio-dev@...>
Date: Wednesday, December 14, 2011 - 11:06 pm

--_6753491a-1d75-4da6-8eaf-6d00c84496d5_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

> if I understand what you're saying=2C the producer should check for sizeo=
f(MyStruct) space before writing=2C=20

Yes. Partial writes are possible but are going have to take care of when yo=
u write the remainder=2C and also cater for partial reads as well. These wo=
uld introduce some ugly timing issues between producer and consumer.

> 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?
Well=2C saying 'just' might be an understatement - there are issues here to=
o but they should be less that writing partial structures.

There was mention of writing pointers to buffers=2C I would avoid this as w=
ell for the possible case that you want to mount your ringbuffers in shared=
memory between processes rather than between threads. It might not be your=
goal now but it would be painful if that changed in the future.

Regards=2C nick.
=

--_6753491a-1d75-4da6-8eaf-6d00c84496d5_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

&gt=3B if I understand what you're saying=2C the producer should check for =
sizeof(MyStruct) space before writing=2C
Yes. Partial writes are possible but are going have to take care of when yo=
u write the remainder=2C and also cater for partial reads as well. These wo=
uld introduce some ugly timing issues between producer and consumer.
&gt=3B 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?W=
ell=2C saying 'just' might be an understatement - there are issues here too=
but they should be less that writing partial structures.There was =
mention of writing pointers to buffers=2C I would avoid this as well for th=
e possible case that you want to mount your ringbuffers in shared memory be=
tween processes rather than between threads. It might not be your goal now =
but it would be painful if that changed in the future.Regards=2C ni=
ck.
=

--_6753491a-1d75-4da6-8eaf-6d00c84496d5_--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [LAD] easiest way to serialize messages for sending over..., Nick Copeland, (Wed Dec 14, 11:06 pm)