Make dictionary thread-safe.