exercise 3.22 message-passing implementation of queue