Async CTP: Does Task.Factory.StartNew use an I / O completion thread?

I use Async CTP and wrote WCF service operation code like this.

public async Task<string> GetDetailsfromDatabase(string name) { return await Task.Factory.StartNew(() => { return CallDatabaseandGetDetails(name); }); } 

The StartNew call uses a thread-stream stream to navigate and retrieve data from the database. Is the thread blocked while db is running or is the I / O completion thread used?

+4
source share
1 answer

You need to use the TaskFactory.FromAsync method:

Example:

http://mstecharchitect.blogspot.com/2011/02/parallel-programming-net-40-ivusing.html

Sincerely.

+1
source

Source: https://habr.com/ru/post/1385058/


All Articles