473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4048
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kiplring | last post by:
Suppose a function which has Sleep() method in it. And I want to recycle it. I made two buttons which call "Resume()" and "Suspend()". But It doesn't work. The state of thread "t" will be...
2
by: Sakharam Phapale | last post by:
Hi All, In following example, while playing file, if thread goes in WaitSleepJoin state, due to Thread.Sleep method. Now I want to suspend thread by clicking on cmdSuspend button. I have...
7
by: Charles Law | last post by:
My first thought was to call WorkerThread.Suspend but the help cautions against this (for good reason) because the caller has no control over where the thread actually stops, and it might have...
1
by: alundi | last post by:
Greetings: I'd like to post this as a new thread to an article in microsoft.public.dotnet.languages.vb originally made by nevin and replied to by Alan Pretre back in December ("ThreadState ==...
2
by: juky | last post by:
Hi all, I have a loop in the thread checking for a particular service status, whenever the status changes to "stopped" a RaiseEvent is generated by thread and another function runs. At the same...
6
by: Buddy Home | last post by:
Hello, I want to understand whats the best way to write code to replace Thread.Suspend, Thread.Resume and Thread.Abort. I have lots of code calling these existing methods and want to minimize...
3
by: =?Utf-8?B?TWFyayBDaGFubmluZw==?= | last post by:
I have a code which registers all threads with a thread dump class. At intervals this thread dump class will dump the stack trace of all threads. As calling StackTrace(threadtoDump) from a...
20
by: cty0000 | last post by:
I have some question.. This is my first time to use thread.. Following code does not have error but two warring The warring is Warning 2 'System.Threading.Thread.Suspend()' is obsolete:...
5
by: Uzi | last post by:
Hi all, I have a thread which is running a long method in a third party component (witch is a com object and accessed via interop). I need to be able to suspend this thread. the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.