Abstract: How to control which processor your application runs on on a multiprocessor machine.
Is there a way to make my application run on one processor of a multiprocessor machine?
Yes. Here are a couple ways you can set process affinity. The first is done while your application is running. Go into the Task Manager and click the Processes tab. Right click on your process and choose Set Affinity. Clear either CPU0 or CPU1.
The second is done in code. Here is an example of setting and getting process affinity:
procedure TForm1.Button1Click(Sender: TObject);
vHandle : Cardinal;
vMaskProcess, vMaskSystem : cardinal;
vHandle := Form1.Handle;
SetProcessAffinityMask(vHandle, 0); // or 1
GetProcessAffinityMask(vHandle, vMaskProcess, vMaskSystem);
Try Delphi XE4 free for 30 days
New Instant Trial!
Webinars on demand!
More social media choices:
Delphi on Google+
@RADTools on Twitter
Server Response from: ETNASC03