VB.Net .net 2.0 在xp上多个程序各自运行线程,vb.net 2010会更好吗?
在过去的几周里,为了加快数据库刷新过程,我创建了几个额外的程序,基本上是 exe 文件的副本。程序本身访问网页、图像等,并使用线程来执行此操作。第二个程序使用 LIMIT 300,100 和第三个 LIMIT 600,100,以确保它们不会处理相同的记录。
在过去的几周之前,该程序曾经有一次在任务调度程序中全天运行没有问题。每个 exe 一次只能运行一次。
由于现在在xp上运行了三个程序,.net 2.0,该程序似乎经常卡住并且永远不会结束。我必须从任务管理器中杀死它。
它在 IDE 中运行良好,
我只是想知道升级到 vb.net 2010 是否有任何好处?
In the past few weeks, to speed up our database freshening process, I've created a couple of extra programs, basically copies of the exe file. The program itself, accesses web pages, images etc and uses threads to do so. The second program uses LIMIT 300,100 and the third LIMIT 600,100, to make sure they don't work on the same records.
Before the last few weeks, one occurrence of the program used to run without problem, from the task scheduler all through the day. Only one occurrence of each exe can run at a time.
Since theres now three programs running, .net 2.0, on xp, the program often seems to get stuck and never ends. I have to kill it from task manager.
It runs fine in the IDE
I just wonder if there would be any benefit from upgrading to vb.net 2010 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您遇到了死锁问题,这在线程代码中很常见。 VS2010 不会神奇地让它消失。 .NET 4.0 中有一个名为 Task 的新类,它简化了管理线程的工作。但如果您的原始代码已经触发了死锁,则同样可能会遇到死锁。您可以用任务重写代码并获得幸运。那种运气通常是短暂的,它会每月一次而不是每小时一次陷入僵局。更糟糕的是,因为排除故障更加困难。
先解决问题,然后再考虑改进。您花在解决这个问题上的时间是非常值得的,完成后您将了解更多有关线程的知识。
You've got a deadlock problem, so common in threaded code. VS2010 isn't magically going to make it disappear. There's a new class in .NET 4.0 called Task, it simplifies the job of managing threads. But is just as likely to suffer from deadlock if your original code is already triggering it. You could rewrite the code with tasks and get lucky. That kind of luck is usually short-lived, it will deadlock once a month instead of once an hour. Far worse since it is so much harder to troubleshoot.
Solve the problem first, consider improving it only after that. And the time you'll spent on chasing this problem is well worth it, you'll know a lot more about threading when you're done.