How to get send the return data to main thread from the secondary thread in C++
I have a function in a main thread which invokes a function which will process my request in the secondary thread. But the secondary thread will take some time to process the request, so I will breaking my process in the main thread(so, it doesn't lock up the things considering the user can perfrom any other actions which will invoke functions in main thread). Once the process in the secondary thread, how can I send the data to main thread(kind of stuck here).
Any sugesstions will be appreciated.
I tried sending a return to main thread(it was waiting on the same line expecting a return), introduced a set method after the return and get method in another function. I know that's wrong way to do it and I'm locking up the things.