How about using Join(timeSpan). If you don't want to block the calling
thread, have it start a "joiner thread" that itself starts your worker
thread and then calls Join on it.
The "joiner thread" would call Abort on the worker thread when it gets
control, if the latter has not yet finished.
"Nicholas Beenham" <ni**********@blueyonder.co.uk> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Hi all,
Is there a way to set the lifespan of a thread.
I am trying to start a process that may or may not have an outcome and
want to finish it after a certain length of time finished or not.
So I have
Thread t = new Thread(new ThreadStart(targetMethod));
t.start();
how can I terminate t after a length of time I decide?
Thanks
Nick