If this Task was not started yet, execute it in the current
thread. If it is finished, return its result. If it is in progress,
execute any other Task from the TaskPool instance that
this Task was submitted to until this one
is finished. If it threw an exception, rethrow that exception.
If no other tasks are available or this Task was executed using
executeInNewThread, wait on a condition variable.
If this Task was not started yet, execute it in the current thread. If it is finished, return its result. If it is in progress, execute any other Task from the TaskPool instance that this Task was submitted to until this one is finished. If it threw an exception, rethrow that exception. If no other tasks are available or this Task was executed using executeInNewThread, wait on a condition variable.