user2713021
user2713021

Reputation: 79

ThreadAffinity in windows

Currently am porting Linux application into windows, I need to set the thread affinity.

currently the Linux method is:

pthread_setaffinity_np(curthread->threadID, sizeof(cpu_set_t), &curthread->coremask);

I need to replace it with equivalent Windows call.

I have found "SetThreadAffinityMask" method as equivalent windows call. Can use this? if yes how place the arguments to this call?

Can someone help me on this.

Upvotes: -1

Views: 299

Answers (2)

Mantosh Kumar
Mantosh Kumar

Reputation: 5731

Yes, thats right. But you need to do some extra work before you can call the above Microsoft API. Please refer my pseudo code explanation from the below link to achieve the same.

https://stackoverflow.com/a/18499947/2724703

Upvotes: 0

Arno
Arno

Reputation: 5194

Possibly useful functions:

Read Multiple Processors and Processor Groups on MSDN as starter.

Upvotes: 1

Related Questions