Closed safesintesi closed 6 months ago
Yeah, the thread can only exit on its own, you cannot manually terminate it. But the idea is to have a simple asynchronous mechanism for reading notifications, not much else. If you require anything more complex, it should no trouble to write your own thread receiving notifications and doing exactly what you want. Using user_data
for whatever you need is also a possibility and is certainly fine, if it works. Nevertheless, like I said, my suggestion is not to use nc_recv_notif_dispatch()
at all.
Thank you for your time. I will move to a dedicated thread as you suggest.
Hello, I'm trying to achieve a dynamic notification callback that can be changed at runtime.
From my understanding
nc_recv_notif_dispatch
opens a new thread that doesn't close until the end of the session (or until the stop time). If I want to change the callback can I send anc_rpc_deletesub
and then open a new subscription or does this leave the thread open? At the moment I solved this with a callback that actually calls the real changing callback passed asusr_data
with a mutex to be thread-safe, but I'm not sure this is the indicated approach. Any guidance would be appreciated.