virThreadPoolFree: Set n(Prio)Workers after the pool is locked
virThreadPoolFree: Set n(Prio)Workers after the pool is locked

In 78839da I am trying to join the worker threads. However, I can't
sipmly reuse pool->nWorkers (same applies for pool->nPrioWorkers),
because of the following flow that is currently implemented:

1) the main thread executing virThreadPoolFree sets pool->quit = true,
wakes up all the workers and wait on pool->quit_cond.

2) A worker is woken up and see quit request. It immediately jumps of
the while() loop and decrements pool->nWorkers (or pool->nPrioWorkers in
case of priority worker). The last thread signalizes pool->quit_cond.

3) Main thread is woken up, with both pool->nWorkers and
pool->nPrioWorkers being zero.

So there's a need to copy the original value of worker thread counts
into local variables. However, these need to set *after* the check for
pool being NULL (dereferencing a NULL is no no). And for safety they can
be set right after the pool is locked.

Reported-by: John Ferlan <87558058f6f829e5ec976c8ef960720af4ff9c7d@redhat.com>
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

crobinso/libvirt,jfehlig/libvirt,agx/libvirt,nertpinx/libvirt,datto/libvirt,rlaager/libvirt,datto/libvirt,nertpinx/libvirt,jardasgit/libvirt,datto/libvirt,fabianfreyer/libvirt,rlaager/libvirt,taget/libvirt,nertpinx/libvirt,shugaoye/libvirt,shugaoye/libvirt,zippy2/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,andreabolognani/libvirt,elmarco/libvirt,taget/libvirt,olafhering/libvirt,crobinso/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,agx/libvirt,rlaager/libvirt,fabianfreyer/libvirt,olafhering/libvirt,rlaager/libvirt,zippy2/libvirt,crobinso/libvirt,jardasgit/libvirt,eskultety/libvirt,taget/libvirt,shugaoye/libvirt,andreabolognani/libvirt,olafhering/libvirt,eskultety/libvirt,libvirt/libvirt,nertpinx/libvirt,jfehlig/libvirt,libvirt/libvirt,andreabolognani/libvirt,elmarco/libvirt,andreabolognani/libvirt,taget/libvirt,datto/libvirt,eskultety/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,elmarco/libvirt,crobinso/libvirt,VenkatDatta/libvirt,VenkatDatta/libvirt,shugaoye/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,eskultety/libvirt,agx/libvirt,VenkatDatta/libvirt,agx/libvirt,zippy2/libvirt,eskultety/libvirt,jardasgit/libvirt,taget/libvirt,libvirt/libvirt,elmarco/libvirt,jardasgit/libvirt,zippy2/libvirt,jfehlig/libvirt,olafhering/libvirt,libvirt/libvirt,agx/libvirt,jardasgit/libvirt,datto/libvirt,andreabolognani/libvirt,rlaager/libvirt,elmarco/libvirt