Implemeted thread-safe macroses