le 02/04/2009 10:27, Eleanor McHugh nous a dit:

> 
> You could write something like:
> 
> 	def thread_dead? worker
> 		(Time.now - worker[:started_at] > 5) && (worker[:thread].status ==  
> false)
> 	end
> 
> 	@semaphore.synchronize do
> 		hs.delete_if do |k, v|
> 			v.map! { |worker| thread_dead?(worker) ? (cleaned += 1; nil) :  
> worker }.compact!
> 			v.empty?
> 		end
> 	end
> 
> 

Your delete_if solution is quite elegant because self explanatory !

Thanks