no need to synchronize thread local value
replace rt.qsort with libc wrapper
use reentrant qsort_r where available

- this avoids one TLS access per comparison