mdbx: more rework TLS cleanup on thread termination.
mdbx: more rework TLS cleanup on thread termination.

One more re-fix https://github.com/ReOpen/ReOpenLDAP/issues/48
Here is only part of the work for glibc >= 2.18

--

Unfortunately, the two bugs related to pthread_key_delete()
are present in all glibc versions:

1) The race condition between pthread_key_delete() and thread's
finalization path, from where a TSD-destructors are called.
Therefore some TSD-destructor(s) could be executed after that
the pthread_key_delete() was competed.

2) ld.so infrastructure does not tracks a TDS-destructors.
Therefore a lib.so could be unloaded while corresponding a
TSD-destructor(s) were even not completed or still were not called.

Change-Id: I47eba97df57fd4c7a5bf3a8f9f12d72ba898cae5

leo-yuriev/libfpta,leo-yuriev/libfpta