coding for blocking queue, include test coding