use heap to schedule tasks for lower memory usage

threadpool task queue can now either be a FIFO queue (the old way) or a
priority queue (implented as a heap).

For mtpt(), run tasks in this order:
  1. dir_exit_method
  2. file_method
  3. dir_enter_method

By doing so, we finish up as many tasks from the queue as possible before
potentially adding new tasks to the queue, requiring fewer tasks to be
resident in memory.

During light testing on typical directories, I saw as much as a 16x reduction
in the maximum size of the queue.