Implemented the lock-free pop() method