关于CCR和WCF集成的问题

发布于 2024-07-15 09:13:22 字数 281 浏览 8 评论 0原文

关于此解决方案将 CCR 与异步 WCF 服务结合使用

为什么需要为此:

ThreadPool.QueueUserWorkItem(s =>callback(this));

而不是仅仅调用回调(this)?

QueueUserWorkItem 不会使用另一个线程吗?

Regardind this solution Using the CCR with ASynchronous WCF Service

Why do you need to do this :

ThreadPool.QueueUserWorkItem(s => callback(this));

instead of just calling callback(this) ?

Isn't QueueUserWorkItem going to use yet another thread ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

“callback”是一个需要作为输入参数提供给BeginGetAccount 的方法。 在答案中,它没有指定“回调”方法,因此无法知道它是否使用新线程,因此将“回调”方法放在 Complete 中的单独线程上确实有意义。

如果您可以保证“回调”创建了自己的线程,那么您就不需要在 Complete 方法中创建一个线程。

"callback" is a method that needs to be provided as an input parameter to BeginGetAccount. In the answer it doesn't specify the "callback" method so there is no way to know if it makes use of a new thread or not and therefore it does make sense to put the "callback" method on a seperate thread in Complete.

If you could guarantee "callback" created its own thread then you wouldn't need to create one in the Complete method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文