using two locks to implement blocking queue