WPF 线程、后台工作者、调度程序

发布于 2024-07-30 05:09:19 字数 75 浏览 2 评论 0原文

我是wpf线程的新手,现在我们有了backgroundworker和dispatcher类,经典的winforms线程问题不再是问题了?

I am new to wpf threading, now that we have backgroundworker and dispatcher classes, classic winforms threading issues are no longer a problem?

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

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

发布评论

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

评论(2

叫思念不要吵 2024-08-06 05:09:19

您仍然可能会遇到所有这些问题。 WPF 并没有神奇地解决任何线程问题。 它只是为您提供了更多可用的工具。 BackgroundWorker 已经存在了一段时间,虽然很有用,但它仍然有可能出现死锁、竞争条件等。线程问题的最佳解决方法是一如既往地仔细开发和小心调试。

You can still have all of these problems. WPF hasn't magically solved any threading issue. It just gives you a couple more tools to use. BackgroundWorker has been around for a while, and although useful, it is still just as possible to get deadlocks, race conditions, etc. The best cure for threading issues, is, as always, careful development and careful debugging.

随梦而飞# 2024-08-06 05:09:19

我在专业情况下拥有丰富的线程经验,包括相当多的 WPF 经验,但我可以告诉您,它并不能解决任何这些问题。

它比 winform 更好,因为 Dispatcher 可以让您更清楚地了解线程模型是什么,但仅此而已。

即使他们愿意,它实际上也不能做更多的事情。 线程本质上是一件复杂而丑陋的事情,你不能仅仅通过几个 GUI 库就神奇地让它消失

I have plenty of hands on threading experience in a professional situation, including quite a bit with WPF, and I can tell you that it does not solve any of these problems.

It is nicer than winforms in that the Dispatcher gives you a more clear idea of what the threading model is, but it doesn't go much further than that.

There isn't really much more that it could do even if they wanted to. Threading is an inherently complicated and ugly thing, and you can't just magically make it go away with a few GUI libraries

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