1- Improve the lock in ts_resource_ex() in order to cover less code. 2 This can probably be done by more careful hash table access 3