Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to run Multiple threads
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01213236
Message ID:
01215140
Vues:
13
I did not want to muddy any waters I just wanted Gerard to be aware of the BackgroudWorker class.

I must disagree that the BackgroudWorker class was targeted for win forms. It is a class like anything else, it just happends to be in the toolbox and can easily be dropped onto a form.

A "standard thread" also requires a method to run. 2 (or 3 or x) instances of the BackgroudWorker class can be hooked up to the same DoWork event.

Anywho, I don't want to arge which one is better for Gerard, I just wanted to make Gerard aware of the BackgroudWorker class if he wasn't already.

>For Gerard's stated requirement, the BackgroundWorker component is in-appropriate. Firstly, it is really targeted for use with forms. Running a couple of loops at the same time doesn't sound like a typical form oriented task.
>
>Also, BackgroundWorker requires at least one event handler to be created and can use upto three. For Gerard's requirement, he wants to run two loops (or more) on separate threads - this would require two BackgroundWorker components, and consequently two "DoWork" event handlers - one to handle each independent loop.
>
>To avoid muddying the waters, he would be better advised to simply create two threads and start them or, use the .NET ThreadPool.
>
>>If you are using .NET 2.0 (or better) you can use the BackgroundWorker component. http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx
>>
>>This class takes a lot of the work out to working with threads. For a while this was my favorite feature in 2.0.
>>
>>HTH
>>
>>>Hi.
>>>Anybody know how to run a no. of threads concurrenly (in either c# or c+++
>>>e.g.
>>>say loop 1 loops arounf displaying 'This is Loop 1'
>>>and Loops 2 loops around saying 'This is loop 2'
>>>
>>>Regards,
>>>Gerard
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform