473,320 Members | 1,902 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,320 software developers and data experts.

Dispose of Worker Thread?

I have a windows forms app (VS 2005) that uses a worker thread to do
lots of stuff in a job. When I run the job again - always after the
first completes - from the app (back to the UI thread to spawn another
worker thread) I notice that the performance has slowed a lot. Is there
something I need to do to properly dispose of the first worker thread,
or is that management already built in?

Apr 20 '06 #1
3 10278
Hi,

No really, when the method that spawned the thread finish the thread is
done.
Are you keeping a reference to the thread in the main UI?
does the thread send back or interact in any way with the UI?
what part of the method itself is slower? maybe it has nothing to do with it
running in a thread, what if you execute it directly in the UI, do you see
the same results when you run it the second time?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<jo*********@topscene.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I have a windows forms app (VS 2005) that uses a worker thread to do
lots of stuff in a job. When I run the job again - always after the
first completes - from the app (back to the UI thread to spawn another
worker thread) I notice that the performance has slowed a lot. Is there
something I need to do to properly dispose of the first worker thread,
or is that management already built in?

Apr 20 '06 #2
The thread is doing lots of copies via System.IO.File.Copy. It also
interacts a lot with the UI thread via delegates and Invoke calls.

Apr 20 '06 #3
Hi,

Well execute it in the UI thread and see what happens, you can leave all the
Invoke methods in place.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<jo*********@topscene.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
The thread is doing lots of copies via System.IO.File.Copy. It also
interacts a lot with the UI thread via delegates and Invoke calls.

Apr 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark Hoffman | last post by:
All, My application spawns a worker process by calling BeginInvoke with an asynchronous callback method. This callback method is responsible for calling EndInvoke. No problems there; pretty much...
5
by: Stephen Lamb | last post by:
I have a background worker thread which I start from a form's HandleCreated event that makes calls back to the form using Invoke. During shutdown the form is disposed and the background worker...
15
by: Sam Sungshik Kong | last post by:
Hello! A disposable object's Dispose() method can be called either explicitly by the programmer or implicitly during finalization. If you call Dispose, the unmanaged resources are released...
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...
6
by: Joe Jax | last post by:
I have an object that spawns a worker thread to process one of its methods. That method processes methods on a collection of other objects. During this processing, a user may request to cancel the...
5
by: Soren S. Jorgensen | last post by:
Hi, In my app I've got a worker thread (background) doing some calculations based upon user input. A new worker thread might be invoked before the previous worker thread has ended, and I wan't...
14
by: joey.powell | last post by:
I am using VS2005 for a windows forms application. I need to be able to use a worker thread function to offload some processing from the UI thread. The worker thread will need access to a...
4
by: dgleeson3 | last post by:
Hello all Yes I know its been done before, but something silly is killing me on this. I have the standard progress bar and worker thread scenario with progress of the worker thread being fed...
1
by: nicerun | last post by:
I'm using the Application_Start event at Global.asax.cs to invoke thread that do some job. I know that Application_Start event occurs when the very first request to Web Application received. -...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.