Rewrite FIFO implementations

Use policy classes to implement the locking so that one class template can serve
conceivably all locking disciplines.

A bug exists in the form a race condition, where a writer can close a locked
queue and a reader will wait forever. FIXME