Re: Thread ending
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Wed, 22 Nov 2006 06:25:24 +0100
Jon,
Why you want to restart it, a thread is removed by the system when it is
ready, just start a new thread is more normally done.
Can you tell us therefore what is the reason for you to restart it.
Cor
"Jon Slaughter" <Jon_Slaughter@xxxxxxxxxxx> schreef in bericht
news:4XO8h.209$wc5.175@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Since a thread doesn't have a Stop feature and I'm not supose to use
abort, I'm wondering how I stop a thread?
My problem is that I simply want to excute a function in the background
and possibly "restart" it.
What've been doing is essentially:
if (SerialRowThread != null)
{
SerialRowThread.Abort();
WaitingThread.Stop();
}
WaitingThread.Start();
SR.Setup(domainUpDown1.SelectedIndex, Intervals, Entries);
SerialRowThread = new Thread(SR.Compute);
SerialRowThread.Start();
----
SR is the class that contains the method compute and SR.Setup sets up the
state.
now this works but I'm wondering if I can just suspend the thread and it
will do the same but not use abort.
i.e., the GC will end up disposing of the thread because I reassign
SerialRowThread. So it will, hopefully, inherently call abort on the
thread or do whatever clean its suppose to do.
Is this method ok(i.e., calling suspend instead of abort in the above
code) or do I need to use some method of pooling threads? I'm still not to
clear on how a thread shuts down because even in pooling it must be done?
Thanks,
Jon
.
- Follow-Ups:
- Re: Thread ending
- From: Jon Slaughter
- Re: Thread ending
- References:
- Thread ending
- From: Jon Slaughter
- Thread ending
- Prev by Date: Re: Closing down a hierarchy of modal windows nicely
- Next by Date: Re: Closing down a hierarchy of modal windows nicely
- Previous by thread: Re: Thread ending
- Next by thread: Re: Thread ending
- Index(es):
Relevant Pages
|
|