[LAD] non-blocking intra-process messaging

From: Stephen Sinclair <radarsat1@email-addr-hidden>
Date: Thu Aug 09 2007 - 22:20:18 EEST

Hi,

I have some multi-threaded audio software that passes data around
using pointers to data structures. However, I'd like a more
generalized message passing system. The only requirements are that it
cannot block the sender or receiver (they are considered soft
'real-time'), and also that multiple senders should be able to send a
message to the same receiver at the same time (which makes
non-blocking circular buffers a difficult approach). I'm thinking of
designing something that uses atomic_ops to implement quick locking of
portions of a message queue.

Anyways, my idea is to use something like OSC for message passing, but
without the "path" part of the OSC address. (That is, the path is
already resolved, since threads share memory..)

Does anyone know if something like this has been done previously?

Ideally it would easily scale to inter-process communication, if in
the future I wanted to turn my threads into processes. (Another
reason for basing it on OSC..)

Does any of this make sense?

Basically I've been running into a lot of shared-memory threading
problems, which in retrospect should have been expected and avoidable
if I'd spent more time designing my message passing system. (At the
time I hadn't heard of the atomic_ops library.)

I might have designed the whole system to use timers instead of
threads and avoided a lot of headaches, but I wanted the threads to be
splittable across CPU cores. (Which arguably is a good reason to use
processes.. admittedly the whole thing is starting to point me towards
the "threads are a bad idea" camp.)

Cheers,
Steve
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
Received on Fri Aug 10 00:15:02 2007

This archive was generated by hypermail 2.1.8 : Fri Aug 10 2007 - 00:15:03 EEST