Callbacks in Threads not Called


i have to applications that are connect via IPC.
The client uses a thread which calls server_ConnectService and then a function like server_dowork(callbackFunc).
The problem is that the callbackFunc doesn’t get called. If I move the server_dowork(callbackFunc) outside of the thread, everything works as expected and callbackFunc is called after work is done.

Why does a callback not work in a thread?

What am I missing here?

Does this application work for server to call the callback function in client?

As I said: it only does if the callback is called outside a thread.

I had a look at the IPC_step4, but this seems to a lot of code that I don’t want to implement, since I only need a simple callback.

So the question remains: why is the callback not working in the thread?

I don’t see problem with legato 20.04 on WP76.

IPC_step4_thread.rar (3.6 KB)

I can see that this is working, however as I said, I want to use simple callbacks and not events since events add a lot of code that I don’t want.

Please see my attached sample app that clearly shows that callbacks are not working if a thread is (2.8 KB)

Better use event api() as it is proven to be working

I think the way you are using is not recommended.
Here says circular dependency is not recommended to avoid deadlocks: