469,636 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,636 developers. It's quick & easy.

Thread Suspend and Resume

Having not used threads for such a long time in vb.net I have found myself
in need of them

I have a thread that runs and retirieves live data from a SQL database, this
is running fine and has been doing its job for a long time

the problem is I need to suspend this thread when a checkbox is clicked (as
the data is no longer required) but when the checkbox is unclicked it needs
to restart

simple enough i thought Suspend/Resume exist, problem is as im sure your
aware, these appear to be on the way out (and will be removed completely
from the next version of the .net framework!!)

how do i now suspend/restart a thread without using defunct code???

ive searched the web for this and everything still points to suspend/resume,
which is of little help to me

thanks in advance

Mike Fellows
Oct 10 '07 #1
1 3846
"Mike Fellows" <mi**********@equityhouse.NO.SPAM.co.ukschrieb
Having not used threads for such a long time in vb.net I have found
myself in need of them

I have a thread that runs and retirieves live data from a SQL
database, this is running fine and has been doing its job for a long
time

the problem is I need to suspend this thread when a checkbox is
clicked (as the data is no longer required) but when the checkbox is
unclicked it needs to restart

simple enough i thought Suspend/Resume exist, problem is as im sure
your aware, these appear to be on the way out (and will be removed
completely from the next version of the .net framework!!)

how do i now suspend/restart a thread without using defunct code???

ive searched the web for this and everything still points to
suspend/resume, which is of little help to me

thanks in advance

Mike Fellows

Simplest way is setting a boolean flag to have a Thread wait for something.
Then use an event (for example AutoResetEvent) set from outside to let the
Thread continue.
Armin

Oct 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Charles Law | last post: by
2 posts views Thread by juky | last post: by
3 posts views Thread by =?Utf-8?B?TWFyayBDaGFubmluZw==?= | last post: by
20 posts views Thread by cty0000 | last post: by
5 posts views Thread by Uzi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.