LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i terminate an executing thread in lab windows

I am using
CmtScheduleThreadPoolFunction(DEFAULT_THREAD_POOL_HANDLE,
Function, (void *) &FunctionData,NULL);
to create a thread for an action. i have a stop button in my GUI wherein i want to give the option to the user to abort a test at any time. How do i program this, how do i termiate this thread .i tried a few option with Cmtdiscard, CmtExitThreadPool . it was not working. Kindly help me with this one.
0 Kudos
Message 1 of 2
(2,833 Views)
Hello

Try the CmtTerminateThreadPoolThread() function. It is not recommended to force a thread to shutdown since it might not clean itself up and might leave resources in a bad state. Check out the help for the above mentioned function for for hints on how to exit threads from a threadpool correctly.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
Message 2 of 2
(2,833 Views)