By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,975 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,975 IT Pros & Developers. It's quick & easy.

2nd thread locks up 1st thread?

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Jon Davis <jo*@REMOVE.ME.PLEASE.jondavis.net> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

P: n/a
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

"Jon Davis" <jo*@REMOVE.ME.PLEASE.jondavis.net> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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

Nov 15 '05 #3

P: n/a
oops .. lost your killfile ..
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m...
Jon Davis <jo*@REMOVE.ME.PLEASE.jondavis.net> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #4

P: n/a
Thanks Sami.

Jon

"Sami Vaaraniemi" <sa***************@jippii.fi> wrote in message
news:bv**********@phys-news1.kolumbus.fi...
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

"Jon Davis" <jo*@REMOVE.ME.PLEASE.jondavis.net> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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


Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.