Lock the trampoline when attaching [v9.18]
When attaching to the trampoline, the isc__trampoline_max was access unlocked. This would not manifest under normal circumstances because we initialize 65 trampolines by default and that's enough for most commodity hardware, but there are ARM machines with 128+ cores where this would be reported by ThreadSanitizer.
Add locking around the code in isc__trampoline_attach(). This also requires the lock to leak on exit (along with memory that we already) because a new thread might be attaching to the trampoline while we are running the library destructor at the same time.
(cherry picked from commit 933162ae)
Edited by Ondřej Surý