Implement prioritized queues.

This pull-request implements numeric priorities inside queues.

I've made sure the fetches are atomic, the tests pass, but the only thing I'm not sure is the latency (because the last item in the list might not be the last one inserted.)

@mperham could do with some feedback regarding the last point (and the whole PR in general.)