Thanks Taazz for your time.
Keep in mind that my complete program is different, but it is based on this example. So we could talk specifically about this example that never "frees" any element from the ThreadList.
> Yes its the correct property to use.
Ok, but this test never works. Why? How could I detect that I need to free the corresponding thread that is ended?
>No you do not check it your self, it is already part of the loop, you need to set to it to true to allow the >consumer to exit its loop.
Ok, I think I mostly understand this, but I would like to free the Thread from this loop, and keep the FreeOnTerminate to false.
If I connect two telnet sessions on it, it keeps updating the number of threads and says it has two.
If I disconnect one, and then reconnect another one, it keeps saying I have three, not two.
>If you have already set the free on terminate property to true also, it should automatically free the >consumer for you when you set the protected field "Done_" to true your self.
I tried also this, I don't need to perform anything special after the thread is finished but I would rather do outside and explicitly, and BTW it didn't work either, this cleaning loop fails to detect that the Thread could be freed (or it has already freed itself) and thus the list never gets the chance to lower the number of elements.
At the moment, there is not the part that deletes the element in the list, but it doesn't matter because the condition is never verified, either if the Thread is freed before or not.
If you could be so kind to test the example for yourself, it would be pretty clear that the number never decrements.
Thanks in advance.
Giuseppe Marullo