Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

Small change in the WriterGUI sample code coming with CVI 2013

$
0
0

I propose to modify the QuitCallback as follow.

In the version hereafter there is a test on the thID before the CmtWaitForThreadPoolFunctionCompletion call

This may be necessary because if for any reason you run the WriteGUI sample code but, for any reason, do not use the Start button then Quit you get an error because thId is not yet a valid thread handle.

Regards, Philippe

 

/*----------------------------------------------------------------------------*/
/* QuitCallback                                                               */
/*----------------------------------------------------------------------------*/
int CVICALLBACK QuitCallback (int panel, int control, int event,
                void *callbackData, int eventData1, int eventData2) {
  switch (event) {
    case EVENT_COMMIT:
    {
      stop = 1;
      if(thID){
        CmtWaitForThreadPoolFunctionCompletion(DEFAULT_THREAD_POOL_HANDLE, thID, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
        CmtReleaseThreadPoolFunctionID(DEFAULT_THREAD_POOL_HANDLE, thID);
      }
      QuitUserInterface (0);
      break;
    }
  }
  return 0;
}

 


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>