2nd thread locks up 1st thread?

  • Thread starter Thread starter Jon Davis
  • Start date Start date
J

Jon Davis

I have a Windows Forms application where I normally had two threads running,
with the second thread started by a main window. The second thread ran in
the background just fine. Then I made some changes and I had the second
thread initiated in a separate window ("owned" by the first thread)--a
progress window that adds a system tray icon--and now I'm finding, whether
coincidentally or not, that the main window locks up when the second thread
is busy (waiting on a web server response). Does anybody know what some
typical causes could explain what might be causing synchronocity between two
threads? If it matters, the second thread does have delegates / events that
get sent to the main window to update the status bar, but those event
handlers don't lock up the application (they basically just update the
status bar text). That is the only thing I know of that

Thanks for any ideas...

Jon
 
Jon Davis said:
I have a Windows Forms application where I normally had two threads running,
with the second thread started by a main window. The second thread ran in
the background just fine. Then I made some changes and I had the second
thread initiated in a separate window ("owned" by the first thread)--a
progress window that adds a system tray icon--and now I'm finding, whether
coincidentally or not, that the main window locks up when the second thread
is busy (waiting on a web server response). Does anybody know what some
typical causes could explain what might be causing synchronocity between two
threads? If it matters, the second thread does have delegates / events that
get sent to the main window to update the status bar, but those event
handlers don't lock up the application (they basically just update the
status bar text). That is the only thing I know of that

Could you produce a short but complete program that does nothing apart
from showing the problem? I find that thread problems are really hard
to find just from descriptions.
 
oops .. lost your killfile ..


Jon Skeet said:
Could you produce a short but complete program that does nothing apart
from showing the problem? I find that thread problems are really hard
to find just from descriptions.
 
Thanks Sami.

Jon

Sami Vaaraniemi said:
This can happen if you access a Form (or any other Windows Forms control)
from a thread other than the UI thread. To make it thread safe, call
methods/properties through Control.Invoke from other threads. This will
execute the call in the thread that owns the control.

Sami
 
This can happen if you access a Form (or any other Windows Forms control)
from a thread other than the UI thread. To make it thread safe, call
methods/properties through Control.Invoke from other threads. This will
execute the call in the thread that owns the control.

Sami
 
Back
Top