checking if t==null before the lock, otherwise we are wasting our lock
checking if t==null before the lock, otherwise we are wasting our lock
a very crude implementation of the remove method