How do I retrieve the name of the current thread?
C++ win console app using MS VS 2010 .net
in my my main line I delcalre thread1 and set the name property. If I look in the watch window the name is there. See below:
// set name and start up thread
thread1->Name = L"Thread1";
// watch window shows thread1->Name is "Thread1"
thread1->Start();
The thread runs but when I look at the name of the current thread it is <undefined value>. See the code below:
// inside of thread1 process, get the current thread name
Thread ^current = Thread::CurrentThread;
// watch window shows current->Name is <undefined value>
Console::WriteLine(current->Name);