c# - Threading (Does these threads exits or aborts itself?) -
i wanted ask clarification program below:
foreach (match match in mc) { string link = match.groups["link"].tostring(); if (link.contains("ebay.de/itm/")) { int endindex = link.indexof("?pt"); link = link.substring(0, endindex); if (link != lastlink) { geteanperlink = delegate { getean(link); }; new thread(geteanperlink).start(); } lastlink = link; } }
it creates lot of threads when program loops. wanted ask if threads ends or exits itself. or if not, how can abort each of threads created?
each thread end when getean
method exits. if does, don't have more, thread , thread
object go away cleanly.
it's possible abort threads, it's not recommended because throws exception in middle of whatever thread doing. recommended way communicate thread want end, can @ convenient place in code.
Comments
Post a Comment