You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello, i'm integrating my other c++ modules into this, which involves calling some long time tasks, i'm looking at async task test: scheduleAndReplyValue, which seems to fit the job, i'm changing it to something like this:
voidlauchTask() {
std::thread::id caller_id = std::this_thread::get_id();
auto runInBackground = [caller_id]() -> std::string {
// remote long time task herereturn"something";
};
auto onResult = [caller_id](std::string res) {
// do something with res
};
std::shared_ptr<mbgl::Scheduler> sheduler = mbgl::Scheduler::GetBackground();
sheduler->scheduleAndReplyValue(mbgl::util::SimpleIdentity::Empty, runInBackground, onResult);
}
question:
is this the correct way for background task which would take long time?
is it safe to launch such task multiple times, do i need to do some clean up?
is thread pool being used or each time new thread will be created?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hello, i'm integrating my other c++ modules into this, which involves calling some long time tasks, i'm looking at async task test: scheduleAndReplyValue, which seems to fit the job, i'm changing it to something like this:
question:
thanks!
Beta Was this translation helpful? Give feedback.
All reactions