When doing a begin… async call, the delegate I pass is handled (according to the documentation) in the default threadpool.
for instance: System.IO.Stream.BeginRead(
byte[] buffer, int offset, int count,
AsyncCallback callback, object state);
How can I make it so that I can use a dedicated threadpool for async method handling?
(I know this can be done since the CCR (Concurrency Coordination Runtime) is also doing this (according to their documentation))
Strictly speaking it is handled in the IO part of the thread pool (asynchronous IO operations have their own set of threads separate from those used by
ThreadPool.Queue*methods).About the only way to do this currently (with released/supported tools) would be to have a stub method passed to
BeginReadthat forwards execution to your own thread pool:The Reactive Framework Extensions (RX) would make this easier: create an
ISchedulerimplementation for your threadpool, but RX is a CTP and likely to be a while before any form of go live.