VB.NET, using myProc (0). ProcessorAffinity = New IntPtr (1)

If previously one specific CPU core was specified using ProcessorAffinity, how to assign everything (as was the default)?

    1 answer 1

    For example:

    Dim mask As IntPtr = New IntPtr((1L << Environment.ProcessorCount) - 1) myProc(0).ProcessorAffinity = mask 

    Source of information: Process.ProcessorAffinity Property on MSDN

    The default depends on the processors on the computer. The default value is 2 n - 1, where n is the number of processors.

    But it’s easier and more correct to save the value before assigning the unit, and restore it later.

    • I'm going to try now. I must confess that I found references to the mask, but did not find examples for more than 1 core. - Shin0by ͓