diff --git a/include/redox/client.hpp b/include/redox/client.hpp index 364dc35..43cfc63 100644 --- a/include/redox/client.hpp +++ b/include/redox/client.hpp @@ -393,9 +393,11 @@ template Command &Redox::createCommand(const std::vector &cmd, const std::function &)> &callback, double repeat, double after, bool free_memory) { - - if (!running_) { - throw std::runtime_error("[ERROR] Need to connect Redox before running commands!"); + { + unique_lock ul(running_lock_); + if (!running_) { + throw std::runtime_error("[ERROR] Need to connect Redox before running commands!"); + } } commands_created_ += 1;