How to cross thread calls in native C++ (call back on main thread)

697 Views Asked by At

I am implementing the C++ mobile apps to call some process which taking some times to make it done, but I need my apps main thread is still running without any blocking.

Question: Is there any library that could just call runOnUIThread to get back the result on main thread?

Understand that there a lot of answer such as message event queue polling to get back the result on main thread, or using future/promise to keep looping the result. But I don't want these kind of solution to achieve the target.

I believe in C++ way has some function to get back main thread looper and call the function with multiple entry point to main thread? I have red this article, I'm not really understand what it means, hope someone could help.

Cross Thread Call in native C++

1

There are 1 best solutions below

0
On

C++ as a language does not have a standard way of doing cross thread messaging. This means you need to implement your own solution that depends on the frameworks you are using.