CnPack Forum


 
mikemb78
新警察
Rank: 1



UID 68016
Digest Posts 0
Credits 12
Posts 3
点点分 12
Reading Access 10
Registered 2014-5-5
Status Offline
Post at 2016-12-7 17:37  Profile | Blog | P.M. 
CPU affinity

Hi,

I use the environment "Start IDE with single CPU". This option allows a stable debugging of my project.
But when the option is not set, the behaviour is in my opinion not correct. If the option is not checked the function "TCnWizOptions.SetUseOneCPUCore", sets the process-affinity to the system-affinity and not to the
process-affinity determined with the function "GetProcessAffinityMask". So if I set the affinity external (e.g. with cmd start /affinity 4 bds.exe) this function resets the external preset.

In my opinion this code-snippet gets the expected behaviour:

procedure TCnWizOptions.SetUseOneCPUCore(const Value: Boolean);
var
  AMask, SysMask: TCnNativeUInt;
begin
  FUseOneCPUCore := Value;
  if GetProcessAffinityMask(GetCurrentProcess, AMask, SysMask) then
  begin
    if FUseOneCPUCore then
      SetProcessAffinityMask(GetCurrentProcess, $0001)
    else
      SetProcessAffinityMask(GetCurrentProcess, AMask);
  end;
end;

Regards
Mike
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2016-12-8 15:38  Profile | Blog | P.M. 
Seems our typo for this API. We'll correct according to your modification. Thanks!
Top
 




All times are GMT++8, the time now is 2024-11-24 11:18

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007862 second(s), 9 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP