I’ve been asked to use an API that makes http calls to a server behind the scenes.
Unfortunately, all the calls are synchronous. I’d like to wrap the classes in this API so that I can make async calls, with the ability to cancel calls.
It would be a licensing violation to publish a WCF service that exposes this API.
Is there a pattern for doing this?
You can always fire off a new Task that runs in a new thread with
Task.Factory.StartNew. If you need the competition notification on a non threadpool thread, I recommend using aSynchronizationContextto schedule it to a different thread.