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 6756
Posts 3554
点点分 6756
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-4-19 07:22

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

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