|
-
Jul 26th, 2006, 10:21 AM
#1
Thread Starter
Lively Member
[2005]what the equivalent suspending in backgroundworker
Hi
in Thread I can use suspend/resume event. what the equivalent in backgroundworker component?
thanks
-
Jul 26th, 2006, 06:34 PM
#2
Re: [2005]what the equivalent suspending in backgroundworker
It is bad practice to arbitrarily suspend threads and Microsoft has deprecated the Suspend and Resume methods with the intention of removing them in future versions. That means that you should NOT be using them at all in any new code. if you want to suspend a thread then you should set a variable that indicates it is so. The thread being suspended can then test that variable at points at which it is safe to be suspended and then do so itself. A BackgroundWorker is just a friendly wrapper around a thread, so you can do the same thing. You simply set a variable that indicates that you want to pause the background operation and when it is safe to do so the methods called from the DoWork event handler can test that variable and pause the current thread if necessary.
Pausing and Resuming Threads
-
Jul 27th, 2006, 03:46 AM
#3
Thread Starter
Lively Member
Re: [2005]what the equivalent suspending in backgroundworker
Hi. Thanks for reply.
What should I write in dowork to pause it? It is my first time use this component
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|