AcceptAsync和BeginAccept的区别

Difference between […]Async and Begin[…] .net asynchronous APIs

 

Note that most *Async methods (with corresponding *Completed events) are using the Event-Based Asynchronous Pattern.

The older (but still perfectly valid) Begin* and End* is a pattern called the Asynchronous Programming Model.

 

The Socket class is an exception to this rule;

its *Async methods do not have any corresponding events;

it's essentially just APM done in a way to avoid excessive memory allocations.

 

The biggest difference between APM and EAP is the thread used for completion notification.

APM will call back on a thread pool thread (unless the request completes synchronously).

EAP will use a cross-framework strategy to call back on a UI thread (if the operation was started from a UI thread).

 

However, both APM and EAP are being replaced with a much more flexible approach based on the Task Parallel Library.

Since the TPL can wrap APMs easily, older classes will likely not be updated directly; extension methods are used to provide Task equivalents for the old APM methods.

For performance reasons, the BCL/TPL teams decided to review each BCL type and add TAP methods directly instead of using extension methods.

These changes will be in .NET 4.5.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值