Bugfix: improve cancellation point processing and handling.
This avoids the use of f_thread_cancel_test() which is horribly limited in design.
Because f_thread_cancel_test() never returns when thread is in cancelled state, the caller cannot properly handle the situation.
This limits the code design in order to properly use f_thread_cancel_test().
There are already cancellation points in place due to the extensive use of thread.enabled.
Improve these cancellation points, adding timed checks to write locks to further check if a cancellation was received (via thread.enabled).
The timeout is arbitrarily pick as "0.1 seconds".
Hopefully, this doesn't make things too busy, but really the write locks should (ideally) never have to be waiting that long anyway.
Remove stale code in private-common.c involving a write lock and then an immediate unlock on deallocation.
Add additional thread.enabled checks.
There were some places where cancellation points were being returned but were not properly unlocking all held locks that are within the scope of the function.
All threads should now be set to PTHREAD_CANCEL_DEFERRED.
The forced thread termination via kill signals are now removed.
They shouldn't be needed now that cancellation (should be) guaranteed.
This will have to be tested over time to confirm the truth of.