> I got the following question , part of my future application I will run
> number of threads according to number of enteries in input xml file. How
> can I dynamically build handlers which will wait for those threads if I
> don't know before the runtime how many threads will be?
What exactly do you mean by "handlers"? Consider how you'd do it if you
knew to start with that you'd use 15 threads. Once you know that, it
will probably be easy to take 15 and make it n.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
csharpula csharp - 12 Mar 2008 14:06 GMT
I don't know how many threads will be,it depends on my xml input. How
can I deal with it?
Jon Skeet [C# MVP] - 12 Mar 2008 14:13 GMT
> I don't know how many threads will be,it depends on my xml input. How
> can I deal with it?
As I said, work out how you'd handle it if you *do* know how many
threads it'll be - taking 15 as an example - then adapt it so that you
can pass in the number of threads as a parameter.
What would you do with 15 threads?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
csharpula csharp - 12 Mar 2008 14:37 GMT
But the question is if I can dynamcally create handlers for each
upcoming thread and if this is not a problematic issue?
Jon Skeet [C# MVP] - 12 Mar 2008 14:45 GMT
> But the question is if I can dynamcally create handlers for each
> upcoming thread and if this is not a problematic issue?
Well, you still haven't said what you mean by a "handler", but yes you
can create threads dynamically. It's not a problem so long as you work
out what you actually want to do with the threads.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
csharpula csharp - 12 Mar 2008 15:21 GMT
My aim to create as much threads as will be in input and to get the
result for each one of them. How can I create dynmically those functions
which will check the thread results?
Jon Skeet [C# MVP] - 12 Mar 2008 15:28 GMT
> My aim to create as much threads as will be in input and to get the
> result for each one of them. How can I create dynmically those functions
> which will check the thread results?
Well, it's more likely that the threads will each feed results to some
central pot.
However, I *strongly* suggest you just write some prototype code with
a fixed number of threads. I really think you'll find you just don't
have the problem you're anticipating.
Jon
Peter Bromberg [C# MVP] - 12 Mar 2008 16:43 GMT
It's starting to sound like you want to study how to use the .NET Threadpool
with the QueueUserWorkItem method and a callback.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
> My aim to create as much threads as will be in input and to get the
> result for each one of them. How can I create dynmically those functions
> which will check the thread results?
>
> *** Sent via Developersdex http://www.developersdex.com ***