The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by dagri]

Hello,

First I want to congratulate for the book , that made me
understand a lot of things between the all 8000-9000 BCL classes!
But, if I want to monitor the state of threads from
ThreadPool in a small application which use NET Remoting
I obtain of each 100 msec always 24 worker_threads and
25 asynchronous IO-threads, when the client call a method on the object-sever.
.NET remoting use ThreadPool to accept requests from
different clients ..... how I can start a Timer thread
in the same ThreadPool , used by NET Remoting ?

Thanks in advance !!!
Daniel G.
import-bot (20211) [Avatar] Offline
#2
Re: ThreadPool
[Originally posted by alan]

ThreadPools are managed by the framework. You don't have a great deal of
control over them. A better approach would be to monitor the threads within
the current process, in which the ThreadPool threads will be included. You
should look at System.Diagnostics.Process and ProcessThread which I talk about
in chapters 3 and 5. Be warned that inspecting the threads in a process
causes additional threads to be created.

Hope this helps,
Alan
import-bot (20211) [Avatar] Offline
#3
Re: ThreadPool
[Originally posted by dagri]


Thank you very much for your response, but in my application I want to use
Thread.IsThreadPoolThread property to monitor/watch only the threads from
ThreadPool.
I want to watch with more details inside ThreadPool ( not to control, just
monitor ) and I find IsThreadPoolThread not accessible from the classes :
Process/ProcessThread .
Is there another method to monitor these threds?


> ThreadPools are managed by the framework. You don't have a great deal of
> control over them. A better approach would be to monitor the threads within
> the current process, in which the ThreadPool threads will be included. You
> should look at System.Diagnostics.Process and ProcessThread which I talk about
> in chapters 3 and 5. Be warned that inspecting the threads in a process
> causes additional threads to be created.
>
> Hope this helps,
> Alan
import-bot (20211) [Avatar] Offline
#4
Re: ThreadPool
[Originally posted by alan]

Not really. The only thing that comes to mind is to create ThreadPool items
that take long enough to ensure that they won't use the same thread that
determine the phsyical thread id of each thread in the ThreadPool. This isn't
the "approved" way of dealing with ThreadPools, but it might work.
Once you have the thread's physical id you could use ProcessThread to monitor
them.