Revert "FIXED: Move termination of threads after calling halt-handlers"
Revert "FIXED: Move termination of threads after calling halt-handlers"

This reverts commit a913bf830b425567beba78088bcab80fd3c6fab4.

Now that we no longer use pthread_cancel() to terminate Prolog threads,
we can use the old ordering again.  The new ordering caused problems due
to active threads while unloading foreign resources.

koryonik/swipl-devel,mndrix/swipl-devel,mndrix/swipl-devel,jn7163/swipl-devel,mndrix/swipl-devel,koryonik/swipl-devel,jn7163/swipl-devel,koryonik/swipl-devel,jn7163/swipl-devel,jn7163/swipl-devel,mndrix/swipl-devel,koryonik/swipl-devel,edechter/swipl-devel,jn7163/swipl-devel,edechter/swipl-devel,edechter/swipl-devel,edechter/swipl-devel,mndrix/swipl-devel,edechter/swipl-devel,koryonik/swipl-devel