diff --git a/include/redox/client.hpp b/include/redox/client.hpp index 43cfc63..6bfca27 100644 --- a/include/redox/client.hpp +++ b/include/redox/client.hpp @@ -400,9 +400,8 @@ Command &Redox::createCommand(const std::vector &cmd, } } - commands_created_ += 1; - auto *c = new Command(this, commands_created_, cmd, callback, repeat, after, free_memory, - logger_); + auto *c = new Command(this, std::atomic_fetch_add(commands_created_, 1), cmd, + callback, repeat, after, free_memory, logger_); std::lock_guard lg(queue_guard_); std::lock_guard lg2(command_map_guard_);