Hi Joecc,
Every task could be running on a different thread, but really they are running on a thread pool so there isn't the cost and expense of creating a new thread each time.
If you don't care about the OnButtonClickRun being asynchronous then I would recommend code like the following. I'm not sure how your above code was compiling because extract_json is asynchronous and returns a task<json::value>. The reason you might be confused with your first code snippet is because you are not using a task based continuation, the http_response assignment is never going to throw an exception.
Every task could be running on a different thread, but really they are running on a thread pool so there isn't the cost and expense of creating a new thread each time.
If you don't care about the OnButtonClickRun being asynchronous then I would recommend code like the following. I'm not sure how your above code was compiling because extract_json is asynchronous and returns a task<json::value>. The reason you might be confused with your first code snippet is because you are not using a task based continuation, the http_response assignment is never going to throw an exception.
json::value json_obj;
try
{
http_response response = client.request(request).get();
json_objc = response.extract_json().get();
} catch(const std::exception &e)
{
// Handle and return
return;
}
// If you have reached here the json_obj variable contains the result....
Steve