Slightly closer emulation of the BlockingQueue API.