J
Joe HM
Hello -
I have a function that calls Thread.Abort() to stop a thread in a
_Closed() Method of a GUI. The thread contains a blocking call on a
TCP socket and that is the easiest way to stop that.
This thread is also outputting strings in a RichTextBox and in some
rare instances I get a System.NullReferenceException when I exit the
GUI. It seems like the _Closed() Method calls Thread.Abort() and then
continues closing down/disposing the form elements while the thread is
still trying to access the RichTextBox.
I guess I might have to add some mutex or similar locking mechanism to
make sure that this cannot happen. I just throught that the
Thread.Abort() would wait ... or doesn't it?
Any suggestions?
Thanks!
Joe
I have a function that calls Thread.Abort() to stop a thread in a
_Closed() Method of a GUI. The thread contains a blocking call on a
TCP socket and that is the easiest way to stop that.
This thread is also outputting strings in a RichTextBox and in some
rare instances I get a System.NullReferenceException when I exit the
GUI. It seems like the _Closed() Method calls Thread.Abort() and then
continues closing down/disposing the form elements while the thread is
still trying to access the RichTextBox.
I guess I might have to add some mutex or similar locking mechanism to
make sure that this cannot happen. I just throught that the
Thread.Abort() would wait ... or doesn't it?
Any suggestions?
Thanks!
Joe