By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

Stoping All the Threads in Thread Pool

P: n/a
Hi,
I have a requirement while using ThreadPool class.
I am creating n number of threads using ThreadPool class, using
WaitCallback
method. In this Method I want to stop all the threads started from
main method using ThreadPool.
Is it possible? If yes, how?

Thanks in advance.
Regards,
Santosh L N
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Santosh,

I don't think that it is possible at all because threads are managed by pool
which won't let you mess with them.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Santosh" <ln*******@yahoo.com> wrote in message
news:49*************************@posting.google.co m...
Hi,
I have a requirement while using ThreadPool class.
I am creating n number of threads using ThreadPool class, using
WaitCallback
method. In this Method I want to stop all the threads started from
main method using ThreadPool.
Is it possible? If yes, how?

Thanks in advance.
Regards,
Santosh L N

Nov 15 '05 #2

P: n/a
Thanks Miha,
My actual problem is, I am creating n number of threads in an array of
Thread class, and I am stopping all the running threads on fail of any
single thread.
The problem is I have no control over CPU usage, it goes up to 100%.
In this case I think, I need to end up with writing my own ThreadPool
class. Is there any better way of solving my problem?

Santosh L N

"Miha Markic" <miha at rthand com> wrote in message news:<uF**************@TK2MSFTNGP10.phx.gbl>...
Hi Santosh,

I don't think that it is possible at all because threads are managed by pool
which won't let you mess with them.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Santosh" <ln*******@yahoo.com> wrote in message
news:49*************************@posting.google.co m...
Hi,
I have a requirement while using ThreadPool class.
I am creating n number of threads using ThreadPool class, using
WaitCallback
method. In this Method I want to stop all the threads started from
main method using ThreadPool.
Is it possible? If yes, how?

Thanks in advance.
Regards,
Santosh L N

Nov 15 '05 #3

P: n/a
Hi Santosh,

"Santosh" <ln*******@yahoo.com> wrote in message
news:49*************************@posting.google.co m...
Thanks Miha,
My actual problem is, I am creating n number of threads in an array of
Thread class, and I am stopping all the running threads on fail of any
single thread.
The problem is I have no control over CPU usage, it goes up to 100%.
In this case I think, I need to end up with writing my own ThreadPool
class. Is there any better way of solving my problem?


You'll never have control over CPU usage.
You might set thread's priority (Thread.Priority) and that's pretty much it.
Note that even a thread with Lowest priority will push cpu usage to 100% but
will let other threads eat more cpu cycles.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.