开发者

Detect Processor Affinity/Priority Change in .NET?

开发者 https://www.devze.com 2023-03-06 15:57 出处:网络
I wrote a small executable in C# .NET that manages a .jar file. Our web software doesn\'t work with .jar files, so my program starts/stops/etc the Java application.

I wrote a small executable in C# .NET that manages a .jar file. Our web software doesn't work with .jar files, so my program starts/stops/etc the Java application.

I need to be able to detect if the Process开发者_开发问答or Affinity or the Priority changes on my executable though so I can change in on the Java process. Is there any way to do this?


You'd have to poll the system using a timer. You'd also have to keep a Process object referring to the process running your .jar. On each iteration, just set the other process's values to your current process's values

var myProc = System.Diagnostics.Process.GetCurrentProcess();
jarProc = myProc.ProcessorAffinity;
jarProc = myProc.BasePriority;
jarProc = myProc.PriorityBoostEnabled;
0

精彩评论

暂无评论...
验证码 换一张
取 消