define attribute methods in a thread safe manner