----- Original Message ----- 
From: "Ray Albert" <[EMAIL PROTECTED]>
To: "Sisyphus" <[EMAIL PROTECTED]>;
<[email protected]>
Sent: Saturday, January 21, 2006 2:55 AM
Subject: RE: Windows2000 Process Affinity


> Hello,
>
> Following is the code I am running to retrieve current processor affinity,
and reduce the number of cpus by one. The call to the
GetProcessAffinityMask() method is successful. I get a memory reference
error when calling the SetProcessAffinityMask() method.
>
>
> Win32::Process::Open($hprocess,$$,1); #open process for current processid
>
>
$hprocess->GetProcessAffinityMask($processaffinitymask,$systemaffinitymask);
>
> if (($processaffinitymask > 1) && ($processaffinitymask % 2 == 1)) {
>
> #remove cpu0 from affinity mask
> $processaffinitymask--;
>
> $hprocess->SetProcessAffinityMask($processaffinitymask);
> }
>

Hmm .... probably can't help much - not aided by the fact that I don't have
access to a multi-cpu machine :-)

Do you get any diagnostic printed to the console *after* you acknowledge the
memory reference error ?

Did you try:
if(!$hprocess->SetProcessAffinityMask($processaffinitymask)) {print $^E};
(Faik, the segfault will prevent you from seeing $^E .... I'm not sure.)

Does it work ok if you comment out the line '$processaffinitymask--' ?

Presumably $processaffinitymask has an initial value of 3. What happens if
you set it to 1 ?

*Should* one be able to remove a CPU from the current process ? (I mean "Is
that allowed ?")

If you create a process with Win32::Process::Create(), can you then set the
mask to remove a cpu ? ... or do you get essentially  the same error ?

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to