i need to get threads running for my c# project
as i have a list of int that calling function
example
protected void Page_Load(object sender, EventArgs e)
{
list<int> lst=new list<int>();
lst.addrange(/// get list of int from data base);
foreach(int number in lst)
{
call(number );
}
getAllThreads();
}
public void call(int x)
{
Thread newThread = new Thread(() => { calc(x); });
newThread.Start();
newThread.name=x.tostring();
}
public void calc(int x)
{
..... do something
}
and i need to know which threads still running or finished
ie
i need to know which int still running or finished
i tried to use Thread.CurrentThread.Name
as in other function
private void getAllThreads()
{
string name= Thread.CurrentThread.Name;
}
but it always null
i tried using
Thread.CurrentThread.ManagedThreadId
but it's value different than
Thread.id