how to use threadlocal.