I want to return function 'A' with some return value(let's say '0') while a daemon thread started running inside this function but may not finished. Is that even possible?
Just detach the thread and then return from the function.
int createThreadAndReturn() {
std::thread(daemon_thread_function).detach();
return 0;
}