473,320 Members | 2,071 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.

Stoping All the Threads in Thread Pool

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
3 7751
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: AnalogKid | last post by:
Short question: What's the difference between SingleUse and MultiUse ? Long question: I've been writing some sample code to see how different Instancing values and threading models work. I...
6
by: Max Adams | last post by:
Threads and ThreadPool's If I use a ThreadPool how can I tell when a thead in the threadpool has exited? I don't want to set a global member variable I would much rather be able to act on an...
9
by: Eric Sabine | last post by:
Can someone give me a practical example of why I would join threads? I am assuming that you would typically join a background thread with the UI thread and not a background to a background, but...
6
by: Quiet Man | last post by:
Hi all, I'm designing a fairly simple service that will run on W2K/SP4 and W2K3 servers. It's job is to be a very specialized database server that listens on a given IP address / TCP port and...
11
by: Peter Kirk | last post by:
Hi there I am looking at using a thread-pool, for example one written by Jon Skeet (http://www.yoda.arachsys.com/csharp/miscutil/). Can anyone tell me if this pool provides the possibility to...
0
by: TY | last post by:
Hi Everyone, I have a multithreading application, a typical Main thread that uses the ThreadPool.QueueUserWorkItem method to add new threads to the Thread POOL. I need a way to control the...
11
by: vzaffiro | last post by:
Does the magic number of 25 only apply to the thread pool? Does it also apply to manually creating threads?
15
by: Bryce K. Nielsen | last post by:
I have an object that starts a thread to do a "process". One of the steps inside this thread launches 12 other threads via a Delegate.BeginInvoke to process. After these 12 threads are launched,...
4
by: gsimmons | last post by:
I've been researching multi-threaded WinForms apps and thread synchronization stuff for a couple days since I'm working on refactoring a multi-threaded GUI app at work and want to be sure it's...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: 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.