c# - Visual Studio print thread name in thread exit message -
i'm trying debug when threads exiting in order track down issue. per this thread, i've given threads name. however, on exit message in visual studio, still not print thread name, id so:
the thread 0x1ed4 has exited code 259 (0x103)
is there setting or i'm missing? i've looked everywhere in vs, can't seem find anything.
and maybe i'm naming wrong, here small example shows i'm talking about:
class program { static manualresetevent athreadmre; static void main(string[] args) { athreadmre = new manualresetevent(false); thread athread = new thread(process); athread.name = "a_thread"; athread.start(); /// ... thread.sleep(timespan.fromseconds(5)); /// ... athreadmre.set(); athread.join(); } static void process() { // make sure name set console.writeline(thread.currentthread.name); int counter = 0; while (true) { if (athreadmre.waitone(timespan.fromseconds(1))) { break; } console.writeline(++counter); } } }
Comments
Post a Comment