diff --git a/src/MariaDbConnection.h b/src/MariaDbConnection.h index cb40e28..46632de 100644 --- a/src/MariaDbConnection.h +++ b/src/MariaDbConnection.h @@ -21,6 +21,7 @@ #ifndef _MARIADBCONNECTION_H_ #define _MARIADBCONNECTION_H_ +#include #include #include "MariaDbStatement.h" @@ -74,7 +75,7 @@ public: bool nullCatalogMeansCurrent; private: std::unique_ptr callableStatementCache; - volatile int32_t lowercaseTableNames= -1; + std::atomic lowercaseTableNames{-1}; bool _canUseServerTimeout; bool sessionStateAware; int32_t stateFlag= 0 ; diff --git a/src/MariaDbStatement.h b/src/MariaDbStatement.h index 8297711..b3500c2 100644 --- a/src/MariaDbStatement.h +++ b/src/MariaDbStatement.h @@ -21,6 +21,7 @@ #ifndef _MARIADBSTATEMENT_H_ #define _MARIADBSTATEMENT_H_ +#include #include #include @@ -57,12 +58,12 @@ protected: bool canUseServerTimeout; Shared::ExceptionFactory exceptionFactory; - volatile bool closed= false; + std::atomic closed{false}; int32_t queryTimeout= 0; int64_t maxRows= 0; Shared::Results results; int32_t fetchSize; - volatile bool executing= false; + std::atomic executing{false}; sql::Ints batchRes; sql::Longs largeBatchRes; diff --git a/src/protocol/capi/ConnectProtocol.h b/src/protocol/capi/ConnectProtocol.h index e820866..5a673f7 100644 --- a/src/protocol/capi/ConnectProtocol.h +++ b/src/protocol/capi/ConnectProtocol.h @@ -79,7 +79,7 @@ namespace capi bool readOnly= false; FailoverProxy* proxy= nullptr; - volatile bool connected= false; + std::atomic connected{false}; bool explicitClosed= false; SQLString database; int64_t serverThreadId= 0; diff --git a/src/util/ServerPrepareResult.h b/src/util/ServerPrepareResult.h index 88264fb..833d14d 100644 --- a/src/util/ServerPrepareResult.h +++ b/src/util/ServerPrepareResult.h @@ -51,8 +51,8 @@ class ServerPrepareResult : public PrepareResult { std::unique_ptr metadata; std::vector paramBind; Protocol* unProxiedProtocol; - volatile int32_t shareCounter= 1; - volatile bool isBeingDeallocate= false; + std::atomic shareCounter{1}; + std::atomic isBeingDeallocate{false}; std::mutex lock; public: