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

Yuri yuri at rawbw.com
Thu Sep 14 12:18:10 PDT 2017


The man page doesn't mention anything about thread-safety 
(https://www.systutorials.com/docs/linux/man/3-suil).


I am running EQ6Q Mono equalized gtkmm UI in a separate thread, 
delivering control value changes from the Qt app using 
suil_instance_port_event, so that there are 2 threads: Qt UI and Gtkmm 
UI threads.

When suil_instance_port_event is called from the Qt thread, EQ6Q gtkmm 
frequently asserts and crashes. I had to pass suil_instance_port_event 
arguments through the thread-safe buffer into the timeout handler set up 
with g_timeout_add.

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?


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. Documentation 
(http://drobilla.net/docs/lilv) doesn't mention atomicity. In general, 
reading/writing 4-byte values isn't atomic 
(https://stackoverflow.com/questions/54188/are-c-reads-and-writes-of-an-int-atomic). 
There are ways to make such reads/writes atomic, and that's what both 
lilv and the app should be doing. Documentation should certainly talk 
about this, and it doesn't. I suspect, lilv also doesn't care about 
atomicity, because I can't find the word 'atomic' in its source.


Yuri



More information about the Devel mailing list