My use case is an application that should registers itself with some methods to handle Ubus calls in thread 1, start listening to Ubus events in thread 2, and send Ubus events in thread 3 (and possibly 4, 5, etc). Everything can and should happen concurrently, e.g. thread 1 could be in the middle of handling a call while thread 2 receives an event, multiple threads may be sending an event at the same time, and so on.
I noticed that internally a global struct blob_buf b
appears to be reused by various functions, so I'm wondering if there's a thread-safe API I can use? Are there applications in OpenWrt that do more than one 'thing' (handle method calls, listen to / send events) in multiple threads I could look at? So far I've only found examples that do just one thing at a time or handle nesting using the ubus_defer_request()
and ubus_complete_deferred_request()
functions, but unless I'm misunderstanding their purpose, I don't think those will help me.