replaced mutex in leak detective with thread scheduling