My bad... I did a few more tests today and noticed the queued
threads total decreasing, 10 threads a time. At some point, it
reached zero, so they do get processed at some point. However, once
my queued threads reached 0, I still had 104 threads running and it
remained like that until I restarted the service in which it reset
to 0.
I just want to know what to do in order to have threads do
what they are supposed to and then stop using resources (memory,
cpu, threads, ect...)
Is calling a terminate at the end of the thread make this
possible or simply making the thread run its course?
My goal is to write a small daemon thread that limits the
number of threads running. Once the max thread number drops, then
the daemon thread starts another one from the queue. The client is
there waiting until his specific thread is done (ajax refresh type
thing).
Since the worker threads will have different timeout points
(or there is no possible way to determine how long the thread can
take), I can't use event gateways (at least I don't think so at the
moment).