Hallo!
the objects in threadlib, or sndfiler
I am thinking of having one "worker" thread which listens for events then calls the output function for each instance of [hid]. So there would only be one worker thread per device, no matter how many instances of [hid] were accessing that device.
yes, [sndfiler] has also only one worker thread ... (see externals/tb/sndfiler/src/sndfiler.c)
You can register a function in a FIFO (fifo_put), and this function will be called from the worker thread, then you can use sys_callback to synchronize with pd's main thread.
LG Georg