thread local storage and rwlock and signal extending functions