CONCPP-134: Remove use of volatile in ServerPrepareResult::shareCounter and others

This commit is contained in:
Zach Toogood
2024-11-01 09:16:32 +00:00
committed by lawrinn
parent 366414f29b
commit 2c636f4be0
4 changed files with 8 additions and 6 deletions

View File

@ -21,6 +21,7 @@
#ifndef _MARIADBCONNECTION_H_ #ifndef _MARIADBCONNECTION_H_
#define _MARIADBCONNECTION_H_ #define _MARIADBCONNECTION_H_
#include <atomic>
#include <mutex> #include <mutex>
#include "MariaDbStatement.h" #include "MariaDbStatement.h"
@ -74,7 +75,7 @@ public:
bool nullCatalogMeansCurrent; bool nullCatalogMeansCurrent;
private: private:
std::unique_ptr<CallableStatementCache> callableStatementCache; std::unique_ptr<CallableStatementCache> callableStatementCache;
volatile int32_t lowercaseTableNames= -1; std::atomic<int32_t> lowercaseTableNames{-1};
bool _canUseServerTimeout; bool _canUseServerTimeout;
bool sessionStateAware; bool sessionStateAware;
int32_t stateFlag= 0 ; int32_t stateFlag= 0 ;

View File

@ -21,6 +21,7 @@
#ifndef _MARIADBSTATEMENT_H_ #ifndef _MARIADBSTATEMENT_H_
#define _MARIADBSTATEMENT_H_ #define _MARIADBSTATEMENT_H_
#include <atomic>
#include <map> #include <map>
#include <mutex> #include <mutex>
@ -57,12 +58,12 @@ protected:
bool canUseServerTimeout; bool canUseServerTimeout;
Shared::ExceptionFactory exceptionFactory; Shared::ExceptionFactory exceptionFactory;
volatile bool closed= false; std::atomic<bool> closed{false};
int32_t queryTimeout= 0; int32_t queryTimeout= 0;
int64_t maxRows= 0; int64_t maxRows= 0;
Shared::Results results; Shared::Results results;
int32_t fetchSize; int32_t fetchSize;
volatile bool executing= false; std::atomic<bool> executing{false};
sql::Ints batchRes; sql::Ints batchRes;
sql::Longs largeBatchRes; sql::Longs largeBatchRes;

View File

@ -79,7 +79,7 @@ namespace capi
bool readOnly= false; bool readOnly= false;
FailoverProxy* proxy= nullptr; FailoverProxy* proxy= nullptr;
volatile bool connected= false; std::atomic<bool> connected{false};
bool explicitClosed= false; bool explicitClosed= false;
SQLString database; SQLString database;
int64_t serverThreadId= 0; int64_t serverThreadId= 0;

View File

@ -51,8 +51,8 @@ class ServerPrepareResult : public PrepareResult {
std::unique_ptr<capi::MYSQL_RES, decltype(&capi::mysql_free_result)> metadata; std::unique_ptr<capi::MYSQL_RES, decltype(&capi::mysql_free_result)> metadata;
std::vector<capi::MYSQL_BIND> paramBind; std::vector<capi::MYSQL_BIND> paramBind;
Protocol* unProxiedProtocol; Protocol* unProxiedProtocol;
volatile int32_t shareCounter= 1; std::atomic<int32_t> shareCounter{1};
volatile bool isBeingDeallocate= false; std::atomic<bool> isBeingDeallocate{false};
std::mutex lock; std::mutex lock;
public: public: