08-09-2005 10:34 AM
I am trying to use the function SetThreadIdealProcessor in CVI. CVI does not have function panels for various Windows SDK functions. I have included the kernal32.lib to my project. I am getting the error "Missing Prototype". I am looking at the following NI documentation on the issue:
You can use the Platform SDK SetThreadIdealProcessor function to specify the processor on which you would like to run a particular thread. The first parameter to this function is a thread handle. The second parameter is the zero-based index of the processor. You can call the LabWindows/CVI Utility Library CmtGetThreadPoolFunctionAttribute function with the ATTR_TP_FUNCTION_THREAD_HANDLE attribute to obtain the handle of a thread pool thread. You can call the LabWindows/CVI Utility Library CmtGetNumberOfProcessors function to programmatically determine the number of processors in the machine that is running your program. You can use the Platform SDK SetProcessAffinityMask function to specify the processors on which the threads in your program are allowed to run. You can use the Platform SDK SetThreadAffinityMask function to specify processors on which a particular thread in your program is allowed to run. The mask you pass to SetThreadAffinityMask must be a subset of the mask you pass to SetProcessAffinityMask. These functions have an effect only when your program runs on a multiprocessor machine with Microsoft Windows 2000/NT 4.0/XP. The Microsoft Windows 9x OSs do not work with multiprocessor machines.
I have a processor which supports hyper-threading(1 proc. looks like 2) and Windows allows you to select to run on one of the processors. I would like to do this, and then in my CVI application, I would like to set up the threads that are being used to collect data over ethernet to be ran on the opposite processor. I have spoken to CVI people before about this issue, but all that they said about is was that there were not function panels for all available functions and I should simply put the right parameters in the function and it should work. This is not the case with the SetThreadIdealProcessor function because the function is of type DWORD and the parameters are of type HANDLE and DWORD. Where are these defined? Also, my thread id's are of type static int. could you please tell me how to prototype these few Windows SDK functions in CVI as well as how to use them with the CmtScheduleThreadPool function returned thread id? I would like to set the entire thread pool to the other processor, but setting each thread to the secondary processor will accomplish the same thing.
08-11-2005 12:39 PM