LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does Word stop responding when LWCVI program is running

My LwCVI program uses several thread pools and several threads.  Each pool's ATTR_TP_PROCESS_EVENTS_WHILE_WAITING is set to 1, true.  When the program runs it sends UDP/IP messages to a peripheral that responds to a waiting recvfrom(), then the program is idle until a timer wakes up the thread that sends the next message that waits for recvfrom().

At anytime I can shake the application window, the LwCVI development window, Windows Explorer and Mozilla windows, but not Word or Outlook.  Word and Outlook get very few CPU cycles.  They will respond after a while but respond immediately after I close the LwCVI application. 

Is there a correction or work around for this problem?
0 Kudos
Message 1 of 3
(3,091 Views)
Hi archieb,

Multithreading issues are often the hardest problems to debug, so please understand that I will need to ask you quite a few questions:
  • What version of CVI are you using?
  • Did you build your application in debug or release mode?
  • Are you running the program from the CVI development environment or from a built executable?
  • How many thread pools are you using?
  • How many threads are in those thread pools?
  • If you strip out as much code from the program as possible, does the problem still occur?
  • Are there any while loops in the code that might be continuously running?
  • When the program is running, does the CPU usage spike to 100%?
  • Are there any other programs besides Word and Outlook that hang?
Thanks in advance for your patience!

Regards,
0 Kudos
Message 2 of 3
(3,048 Views)
Thanks for replying.  On Monday the problem was not there.  I wonder if some piece of code was left running in cvi.exe that was the problem.
  • What version of CVI are you using?    LwCVI 8.1
  • Did you build your application in debug or release mode?   Debug
  • Are you running the program from the CVI development environment or from a built executable?  in the IDE
  • How many thread pools are you using?  There are two additional threads with 4 threads max each plus the main thread.
  • How many threads are in those thread pools?  For the most part there is the main thread and only one other one running at a time.
  • If you strip out as much code from the program as possible, does the problem still occur?  I did not do this.
  • Are there any while loops in the code that might be continuously running?  No.  These are run and finish threads.  They are there since recvfrom blocks and I need the timer that closes the port to be in another thread.  The timer is in the main thread.  If the timer times out it closes the socket which unblocks recvfrom with an error.  No return is an error so I close and open the sockets and then look for problems.  The peripheral is powered down or it has not had its Ethernet Addresses configured.
  • When the program is running, does the CPU usage spike to 100%?  Not this time.  CVI.exe ran persistently at 20% but the idle thread had most of the rest.
  • Are there any other programs besides Word and Outlook that hang?  No only the MS Office programs.  I believe I tried Excel.
I had been testing various rough shut downs and may have left some code running in the CVIRTE.  There are some while loops to wait for one thread to finish before starting another.  In those threads I ProcessSystemEvents() and Delay(0.01) in the while loop.  I will need to see if this comes back.

Thanks for the attention.
0 Kudos
Message 3 of 3
(3,033 Views)