How many models of Asyncronous development in .NET?
2012-02-20 10:39 barbarossia 阅读(170) 评论(0) 编辑 收藏 举报There's at least 4, then - a regular callback (non-APM, non-EAP) is also not uncommon
APM - (BeginXXX EndXXX) Which you are using here, when the long running task completes,it calls back into your code in the EndXXX method
EAP - Event based. In this model, when the long running task completes, an event is raised to inform your code.
TPL - New in .NET 4, this is the 'Task' based version. it looks most like Syncronous programming to client code, using a fluent interface. Its calls back to your code using continueWith
Thread.Start
- brutal
delegate.BeginInvoke/EndInvoke
- 'old' standard
ThreadPool.QueueUserWorkItem
- smart
TaskFactory.StartNew
- the only way to do it correct (according to Patterns of parallel programming
book | i recommend you to read it first for disambiguation)
The orignal issure address is : http://stackoverflow.com/questions/9271442/how-many-models-of-asyncronous-development-in-net