[LV2] Is suil_instance_port_event thread-safe? Is lilv atomic-safe when handling changing control port values?

Robin Gareus robin at gareus.org
Thu Sep 14 13:11:44 PDT 2017


On 09/14/2017 09:18 PM, Yuri wrote:


> This leaves me wondering: is suil_instance_port_event supposed to be
> thread safe, and crashes as a result of some bug in EQ6Q Mono, or
> suil_instance_port_event isn't thread safe, and users should take care
> of thread-safety?

From http://lv2plug.in/ns/extensions/ui/ui.html

"UIs written to this specification do not need to be thread-safe. All
functions may only be called in the "UI thread". There is only one UI
thread (for toolkits, the one the UI main loop runs in)."

ergo: The host must call all UI functions in a single thread.


> Another, related issue is between plugin, running in a separate thread,
> and control values changed by the app. Control values are floating point
> numbers, shared between the app and a plugin using
> lilv_instance_connect_port.

A plugin cannot modify its own inputs, so atomicity is not needed. It's
always the host that writes values and the values must not change while
a plugin's run() is called.

A common implementation technique is for the host to double-buffer the
control-parameters and set them before calling lilv_instance_run().

HTH,
robin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20170914/be18cc3a/attachment.sig>


More information about the Devel mailing list