Forcing an app to run single core only?

前端 未结 3 1189
萌比男神i
萌比男神i 2021-01-21 03:26

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

3条回答
  •  清歌不尽
    2021-01-21 04:14

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

    Edit: 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).

提交回复
热议问题