Hi to all,
I would like to know to what an extent (if at all) calling open62541 functions is safe while UA_Client_runAsync() is running in another thread.
Context: I have a piece of software in which I need to relay data transfers (reads, writes, subscriptions) between user code and a backend OPC-UA client. The idea was to create an UA_Client along with a thread that would call UA_Client_runAsync() in a loop. Asynchronous calls would then be called from user code, and my backend would dispatch the results when they arrived.
However, it quickly became clear that at least some open62541 functionality could not be used concurrently while UA_Client_runAsync() was running in the backend thread. For one, registering a subscription and creating a monitored item resulted in sporadic malfunctions. If I ensured that UA_Client_runAsync() was not active at the same time, everything went well, so it seemed to be concurrency-related. At this point I started questioning whether calling UA_Client_AsyncService_read() or UA_Client_AsyncService_write() – or any other UA_Client function for that matter – concurrently with UA_Client_runAsync() was allowed at all.
I'm using the amalgamated source, version 0.3-rc1.
Kind regards,
Andrej Lajovic