471,853 Members | 927 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

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 3947
"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
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.