Thread-safe way