Add multi-threaded execution to the task runner.

The basic execution logic is the same as for sequential execution but the
place of execution is different.  The main thread spawns off worker threads
as needed and processes the outputs sequentially such that it appears as
sequential albeit fast processing.

Access to memory pools and the task tree need to serialized using mutexes.
Also, some effort is put into assigning tasks to workers in way that maximizes
locality and minimizes interference / overhead between tasks.

* subversion/libsvn_subr/task.c
  (root_t): Add mutexes, flags and condition variables needed.
            Correct the docstring for RESULTS_POOL.
  (svn_task__t): Add pointer to quickly find the next unprocessed sub-tree.
  (link_new_task): Update the new pointer in svn_task__t.
  (next_unprocessed): New utility function.
  (unready_task): Use the utility to update new pointer in svn_task__t.

  (add_task): Sync access to tree. Notify workers of new tasks.
  (svn_task__add): Sync access to memory pool.
  (is_contented,
   set_processed_and_pick): New functions to intelligently pick a task to
                            work on.
  (enforce_sequential_consistency): New synchronization utility.                            
  (output_processed): Sync access to tree.
  (next_task,
   worker_cancelled,
   send_terminate,
   worker,
   worker_thread): New functions implementing the worker tasks.
  (wait_for_outputting_state,
   execute_concurrently): New functions implementing the foreground output
                          processing and controlling the worker tasks.
  (root_cleanup): New utility function.
  (svn_task__run): Initialize the synchronization structures and pick the
                   appropriate execution model.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1888583 13f79535-47bb-0310-9956-ffa450edef68
1 file changed