LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Program hangs at CmtWaitForThreadPoolFunctionCompletion function

Hello,
 
I have a program where the serial port is opened and closed in the main thread. All outgoing communication is handled in the main thread, while another thread is responsible for handling all incoming data. When the user wants to close the serial port, a variable is set. This is detected by the other thread and the thread function will end. In my main thread, I call the function CmtWaitForThreadPoolFunctionCompletion to wait for the second thread function to finish before actually closing the serial port.
Problem: sometimes the main thread hangs at the function CmtWaitForThreadPoolFunctionCompletion, while the thread function is already finished for a long time. I can only end my program the hard way (Ctrl-Alt-Delete, or break the execution when debugging). I really have no idea why the main thread does not continue. Is there anybody who knows why this happens. Note that I call the CmtWaitForThreadPoolFunctionCompletion with the OPT_TP_PROCESS_EVENTS_WHILE_WAITING attribute.
0 Kudos
Message 1 of 5
(4,096 Views)
Hi Wim,

I think you can find an answer to this post, this other one or this last one.
I found some post on the forum that was speaking about the 'problem'.
Maybe you should investigate it if it's not yet done. Smiley Wink

I hope it will help you to resolve your problem. Don't hesitate to reply to this post if your are not satisfied by the answer.

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
Message 2 of 5
(4,066 Views)

Hello Julien,

thanks a lot for the reply. I'll get back to you if these posts don't solve my problem Smiley Wink

Wim

Message 3 of 5
(4,028 Views)
Hello Wim,

I suppose your problem is solved because you didn't get back to me..?

Could you keep me inform? So I can investigate it more or close down the support request.

Regards,
Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 4 of 5
(3,961 Views)

Hello,

Sorry for my late reply. Unfortunately I have not been able to solve the problem. Strange thing is that it doesn't very often, so it's pretty hard to reproduce Smiley Sad

0 Kudos
Message 5 of 5
(3,936 Views)