force inline of scopelock, add ThreadLocal template for ease-of-use of ThreadLocalPointer