本文介绍了强制一个应用程序只运行单一的核心是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有这个奇怪的问题,一些第三方的DLL。第三方提供商引用了一些开源的DLL具有内存异常每当我尝试使用某种方法。当应用程序运行在单核机器上这个问题不会出现,但显然我们不能假设一个用户有。

I have this strange issue with some third party DLL's. The third party provider references some open source DLL's that have a memory exception whenever I try to use a certain method. This issue does not appear when the app is run on a single core machine, but obviously we cannot assume a user will have that.

有没有办法来强制应用程序,甚至更好,但被引用的DLL在单个内核上运行?任何其他方式可能是解决这一问题?获取第三​​方重建OS dll的显然是出了问题(它有点痛点与我目前:)),所以我必须处理它自己或只是忘了提供此功能。

Is there a way to force an app, or even better yet a referenced DLL to run on a single core? Any other way to possibly fix this? Getting the third party to rebuild the OS dll's is apparently out of the question (its a bit of a sore spot with me currently :) ) so I have to handle it myself or just forget about providing this functionality.

顺便说一句,从OS DLL的被抛出的错误消息试图访问损坏或受保护的内存。

By the way, the error message being thrown from the OS DLL's is "Attempting to access corrupt or protected memory".

推荐答案

你想要做的是使用的。请注意,这会让你的整个应用程序运行的单核。

What you want to do is achieved by using Process.ProcessorAffinity. Note that this will make your entire application run single-core.

编辑:您的问题可能是DLL期待有单处理器亲和力的结果,但它也可以是一个线程问题(如比赛条件),这是非常不可能发生的,当你只具有单个芯。如果最后一个是真的,你真的不能做任何事情,除了交叉手指祈祷(也许考虑删除的功能,让您的应用程序稳定)。

your problem may be a result of the DLL expecting to have single-processor affinity, but it can also be a threading issue (e.g. race condition) that is very unlikely to happen when you only have a single core. If the last one is true, you can't really do anything except cross your fingers and pray (and maybe consider dropping the functionality to keep your application stable).

这篇关于强制一个应用程序只运行单一的核心是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 11:22