在单独的线程上加载程序集?
我有一个 .net 程序集(来自 BMC 补救措施,如果有帮助的话),它似乎在多线程设计上存在缺陷。它似乎在主(UI)线程上初始化所有对象,而不管实际构造它们的线程如何,然后常见的跨线程问题随之而来。
有什么方法可以在单独的线程上加载程序集吗?
I have a .net assembly (from BMC remedy, if that helps), that seems to be defective by design regarding multithreading. It seems to initialize all objects on the main (UI) thread, regardless of the thread that actually constructs them, and then the usual cross-thread problems ensue.
Is there any way that I can load the assembly on a separate thread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发布这个答案是因为我想我现在明白了您的观点:
在哪个线程上执行方法取决于该方法的调用者,而不是创建其实例的线程。
因此,为了防止 UI 线程冻结,您必须在另一个线程上启动该操作。网络上有大量关于此主题的资源。
I'm posting this an answer, because I think I got your point now:
On which thread a method is executed depends on the caller of the method, not on the thread its instance was created on.
So to prevent your UI thread from freeezing you have to start the operation on another thread. There are tons of resources about this topic on the web.