01-23-2010 01:16 PM
I'm trying to improve my understanding of multithreading by studying some of the CVI examples.
I notice in the CVI Help page for CmtReleaseThreadPoolFunctionID() the following statement: "This function does not ... interrupt a Thread Function that ... is currently executing.", whereas, in the example IncrementValue.cws, it is explicitly used to do just that! (In CVICALLBACK StopButtonCallback().) This is probably a semantic issue or just confusion on my part.
Please help me understand.
Thanks very much.
01-23-2010 03:48 PM
The mechanism is not exactly what you have depicted: the first thing that StopButtonCallback does is setting running = 0: this makes the scheduled functions to stop (note the while (running) loop that encloses all function body). The stop callback then frees the function IDs, that are to be freed since CmtScheduleThreadPoolFunction has reserved them.
The function IDs are needed to permit CmtWaitForThreadPoolFunctionCompletion to wait for function completion before exiting the program.
01-23-2010 08:33 PM
Roberto,
So it was the latter - confusion on my part! Thanks for the quick reply!
Joe