I have a multithreaded C # .NET application that freezes an interface. What is unusual about this is that the interface does not freeze if I do not let the system stand idle long enough for the splash screen to start (which requires me to re-enter the password to re-access the system). When the interface becomes visible again (after I have successfully entered my password), the interface is locked. Until I let the screensaver run, then the interface is not blocked.
I must indicate that I have two different executables that access the same DLL, and this problem occurs regardless of which application I use to access the DLL. This, apparently, means that the problem is with the DLL, because the two applications are completely different (C ++ / MFC) and (C # /. NET), in addition to how they relate to the DLL.
Both exes perform similar steps in how they interact with the DLL. They make calls to the dll to set up serial port communications, open a status window in the DLL, start the thread in the DLL to monitor the communication port, and then start the thread in the main application that controls the stack in the DLL.
When data is received from the communication port by the stream in the DLL, it is analyzed and its results are pushed onto the stack, and then sent to the status window through the delegate. When a stream in exe sees data on the stack, it displays the data in the main window, also using a delegate.
I found that if I add code to the stream inside the DLL so that it calls Application.DoEvents () every 30 seconds, the interface will freeze for 30 seconds and then resume activity as usual. I suppose something is blocking the main thread and making DoEvents () fire, it seems to block the lock, but I don't know what might cause this lock.
This problem occurs both on my development machine and on the test machine.
I tried to completely remove the data output to the status window inside the DLL, but it did not matter.
I have been doing multithreaded programming for many years and have never seen anything like it; so any advice would be highly appreciated.
Thanks.