G
Guest
Hi! I am trying to write a function that will span a thread for me.
Eventually I want to incorporate this finction into a class:
public void SpanThread(string threadName,string threadDelegate
,ThreadPriority threadPriority, bool haveCallingThreadWaitToComplete)
{
// Bombs on this line:
ThreadStart newThreadStart = new ThreadStart(threadDelegate);
Thread newThread = new Thread(newThreadStart);
newThread.Name = threadName;
newThread.Priority = threadPriority;
newThread.Start();
if(haveCallingThreadWaitToComplete)
{
newThread.Join();
}
}
Question:
How do I pass the name of the delegate to this function so that the compiler
does not complain? Is it possible?
Thank you in advance,
Eventually I want to incorporate this finction into a class:
public void SpanThread(string threadName,string threadDelegate
,ThreadPriority threadPriority, bool haveCallingThreadWaitToComplete)
{
// Bombs on this line:
ThreadStart newThreadStart = new ThreadStart(threadDelegate);
Thread newThread = new Thread(newThreadStart);
newThread.Name = threadName;
newThread.Priority = threadPriority;
newThread.Start();
if(haveCallingThreadWaitToComplete)
{
newThread.Join();
}
}
Question:
How do I pass the name of the delegate to this function so that the compiler
does not complain? Is it possible?
Thank you in advance,