使用.Net 4.0新功能进行并行任务
我之前问过一个关于设计接收视频文件、发送视频文件的服务的问题到编码服务,等待编码完成,然后下载文件。
我开始为此编写代码,我的一位同事建议我使用 .Net 4.0 新功能,而不是使用 BackgroundWorker 编写代码。我读过一些书,并行功能听起来很棒。我还应该实施更多新功能吗?我是 .net 4.0 的新手。
谢谢!
I've previously asked a question about designing a service that receives video files, sends them to an encoding service, waits for the encoding to be completed, and then downloads the files.
I started writing the code for that and one of my workmates suggested I use .Net 4.0 new features, instead of writing it using BackgroundWorker. I've done some reading and the Parallel feature sounds great. Are there any more new features I should implement? I'm new to .net 4.0.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
并行扩展无疑是一个不错的选择。您可能需要考虑的另一个是响应式扩展,它实现了“相反,推”模型。您需要花一点时间才能理解,但它非常优雅 - 并且可能非常适合您的异步模型。
Parallel Extensions is certainly one good option here. Another you might want to consider is Reactive Extensions, which implements a "push" model instead. It takes a little while to get your head round, but it's very elegant - and might work very well with your asynchronous model.