[LV2] worker thread question

David Robillard d at drobilla.net
Sun Dec 30 08:11:22 PST 2012

On Sun, 2012-12-30 at 09:16 +0100, Robin Gareus wrote:
> On 12/30/2012 08:43 AM, hermann meyer wrote:
> > Thanks Robin, for your input, what is open now for me is that I
> > need to read the port values in the worker thread, and that I would
> > watch them "outside" from run(). From what I understand about
> > glib-threads there is no problem as long I only read the values 
> > were my pointers point to (data).
> I'm not aware of the spec mandating specific behavior of port values for
> the host-side implementation of the worker thread. Dave?

Port buffers may only be accessed in run().

The host needs to change them at *some* point, so of course it is not
possible to just allow them to be read at any time at all by any thread.
With some hosts on most architectures you might be able to get away with
that with control ports (if you handle activate and deactivate carefully
and get lucky), but certainly not audio/events/etc and it's definitely
wrong to do so in any case.

Ports are associated with run(), and only run().  If you need their data
in other threads, you must copy it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20121230/28c3bae0/attachment-0002.pgp>

More information about the Devel mailing list