Thread safe pickle/unpickle