The SetThreadIdealProcessor function is used to specify a preferred processor for a thread. The system schedules threads on their preferred processors whenever possible.
DWORD SetThreadIdealProcessor(
HANDLE hThread, |
// handle to the thread |
DWORD dwIdealProcessor |
// ideal processor number |
); |
If the function succeeds, the return value is the previous preferred processor or MAXIMUM_PROCESSORS if the thread does not have a preferred processor.
If the function fails, the return value is - 1. To get extended error information, call GetLastError.
You can use the GetSystemInfo function to determine the number of processors on the computer. You can also use the GetProcessAffinityMask function to check the processors on which the thread is allowed to run. Note that GetProcessAffinityMask returns a bit mask whereas SetThreadIdealProcessor uses an integer value to represent the processor.
GetProcessAffinityMask, GetSystemInfo, SetThreadAffinityMask
file: /Techref/os/win/api/win32/func/src/f83.htm, 2KB, , updated: 2000/4/7 11:19, local time: 2024/11/12 19:52,
18.219.140.44:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/os/win/api/win32/func/src/f83.htm"> SetThreadIdealProcessor</A> |
Did you find what you needed? |