B
Bob Day
Using vs2003, vb.net
I start a thread, giving it a name before start. Code snippet:
'give each thread a unique name (for later identification)
Trunk_Thread.Name = "Trunk_0_Thread"
' allow only 1 thread per line
Trunk_Thread.ApartmentState = ApartmentState.STA
' start thread instance
Trunk_Thread.Start()
1) In that thread, I would expect
Dim x As String = Thread.CurrentThread.Name
To return the the name Trunk_0_Thread, but instead returns nothting.
2) If I give the thread a name in its sub new
thread.currentthread.name= "Trunk_0_Thread"
then later in the thread
Dim x As String = Thread.CurrentThread.Name
returns the proper name.
Why does it not work the in 1) above the first time?
Please advise.
Bob Day
I start a thread, giving it a name before start. Code snippet:
'give each thread a unique name (for later identification)
Trunk_Thread.Name = "Trunk_0_Thread"
' allow only 1 thread per line
Trunk_Thread.ApartmentState = ApartmentState.STA
' start thread instance
Trunk_Thread.Start()
1) In that thread, I would expect
Dim x As String = Thread.CurrentThread.Name
To return the the name Trunk_0_Thread, but instead returns nothting.
2) If I give the thread a name in its sub new
thread.currentthread.name= "Trunk_0_Thread"
then later in the thread
Dim x As String = Thread.CurrentThread.Name
returns the proper name.
Why does it not work the in 1) above the first time?
Please advise.
Bob Day