Be sure to hold the lock before pop an element.