GC don't understand

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu Nov 16 13:39:04 PST 2006


Mariano wrote:
> == Quote from Nahon (lburger at hu.tesco-europe.com)'s article
> 
>>Daniel Keep wrote:
>>(AFAIK when the
>>thread's run() finishes, the thread is terminated. Am I wrong?)
>>Regards,
>>Nahon
> 
> 
> er, if you have an array with referecens to the threads, then they will be kept by the GC. You need to efectivelly
> remove it from the array.
> You can do this with ''threads.remove(dead)'' if in an associative array, or you have to do threads =
> threads[1..dead]~threads[dead+1~length].
> 
> Mariano.

<shameless-plug>

Or:
# import cashew .utils .array ;
#
# // ...
# threads.drop(dead);

Which will perform better than the [..]~[..] expression.
Plus it reads funny: drop dead, thread!  ;)

</shameless-plug>

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list