change Lock to LockT as a template.构造和析构的时候分别上锁解锁