Im trying to invoke a new thread function from a callback function from a button on the .uir.
My code looks something like this:
int CVICALLBACK BUTTON_CALLBACK (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
CmtNewThreadPool (4, &poolHandle);
CmtScheduleThreadPoolFunction (poolHandle, thread_function, NULL, NULL);
}
thread_function(void * functionData) {
do stuff
}
My question is why does it do the stuff twice? Won't it do the statements in the thread_function and then leave. I only want to do stuff x 1. Also, do i need to take any precautions if the user presses the button again? Will it use the same thread that it used before or will it create a new thread to do the same thread_function. Or does this thread get created & recreated since i passed the NULL parameter for the ID. (I looked for this info on the message board and documentation but couldnt find what i was looking for) Thanks