PTFM-11932 Add some diagnostics

* When PrioritizingThreadPool encounters an exception, print it (even
  though the consumer of the future may wish to suppress it).
* Add an assertion to ensure that _queue_lock is held when _next is
  called.
* More distinctive exception when reading 0th item from an empty queue.

(cherry picked from commit 0af65e22ca6fd067afee50c8d16e758c9fb5cfb7)