Add a lock() function in PassRegistry to speed up multi-thread synchronization.