Fire and forget from console application

Apr 29, 2013 at 11:42 PM
I would like to send a number of POST requests on http_client from console application. Console has only one thread.

All POST requests are followed by then, but I would want that continuation to execute on another thread, not on the main console thread, which I want to remain reserved for user i/o.

Can you provide a link to, or an example how to do that?

I know that I am expected to create a scheduler and associate it with a new thread, but frankly, the documentation doesn't make it easy to set things up in this way.
Apr 29, 2013 at 11:50 PM
Hi Tonko,

All continuations are automatically executed on a thread pool thread, so there is no need to create your own scheduler unless you have some special needs to do something different than that. When using asynchronous APIs with a console application, the trick is not how to get work to happen on a background thread, but how to prevent the main thread from exiting: since you want the main thread to be doing I/O (console I/O, I presume), that shouldn't be too hard.


Niklas