Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: How to Cancel and Restart A Task

$
0
0
I search something on server by the following code where g_token is an object of pplx::cancellation_token_source.

request.set_request_uri(build_uri.to_uri());
http_resp = client.request(request, g_token.get_token()).get(); // Request Task

and stop searching in a Message Response Function OnStop() by
g_token .cancel();

then I restart the search but the Request Task always throw an exception "operation canceled".

How can I reset the cancellation token?

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>