G
Guest
Hi,
I have a VB NET class library. In the constructor of the library I spawn off
a thread that is listening for some data. When it gets data it raises an
event.
Constructor has code that looks like the following ::
Private MyThread As Thread
MyThread = New Thread(AddressOf GetData)
MyThread.Start()
In the destructor I have the following code to get rid of the spawned off
thread ::
If (MyThread.ThreadState = ThreadState.Running) Then
MyThread.Abort()
MyThread.Join()
End If
The problem is this:: For a VB NET project using this class library
everything works.
But for C# the thread that was spawned off is not destroyed. This is the
only thing that does not seem to be working well with a C# project using this
class library.
Is there any difference in the way C# and VB NET handle threads?
Thanks in advance,
Pete.
I have a VB NET class library. In the constructor of the library I spawn off
a thread that is listening for some data. When it gets data it raises an
event.
Constructor has code that looks like the following ::
Private MyThread As Thread
MyThread = New Thread(AddressOf GetData)
MyThread.Start()
In the destructor I have the following code to get rid of the spawned off
thread ::
If (MyThread.ThreadState = ThreadState.Running) Then
MyThread.Abort()
MyThread.Join()
End If
The problem is this:: For a VB NET project using this class library
everything works.
But for C# the thread that was spawned off is not destroyed. This is the
only thing that does not seem to be working well with a C# project using this
class library.
Is there any difference in the way C# and VB NET handle threads?
Thanks in advance,
Pete.