mirror of https://gitee.com/bigwinds/arangodb
Fix some uses of atomics (#9141)
This commit is contained in:
parent
1a71cc6898
commit
3323cdcc28
|
@ -43,7 +43,7 @@ void ClusterSelectivityEstimates::flush() {
|
||||||
_updating.store(false, std::memory_order_release);
|
_updating.store(false, std::memory_order_release);
|
||||||
});
|
});
|
||||||
|
|
||||||
std::atomic_store<InternalData>(&_data, std::shared_ptr<InternalData>());
|
std::atomic_store(&_data, std::shared_ptr<InternalData>());
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexEstMap ClusterSelectivityEstimates::get(bool allowUpdating, TRI_voc_tid_t tid) {
|
IndexEstMap ClusterSelectivityEstimates::get(bool allowUpdating, TRI_voc_tid_t tid) {
|
||||||
|
@ -116,5 +116,5 @@ void ClusterSelectivityEstimates::set(IndexEstMap const& estimates) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally update the cache
|
// finally update the cache
|
||||||
std::atomic_store<ClusterSelectivityEstimates::InternalData>(&_data, std::make_shared<ClusterSelectivityEstimates::InternalData>(estimates, ttl));
|
std::atomic_store(&_data, std::make_shared<ClusterSelectivityEstimates::InternalData>(estimates, ttl));
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void V8ClientConnection::createConnection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_lastHttpReturnCode == 200) {
|
if (_lastHttpReturnCode == 200) {
|
||||||
std::atomic_store<fuerte::Connection>(&_connection, newConnection);
|
std::atomic_store(&_connection, newConnection);
|
||||||
|
|
||||||
std::shared_ptr<VPackBuilder> parsedBody;
|
std::shared_ptr<VPackBuilder> parsedBody;
|
||||||
VPackSlice body;
|
VPackSlice body;
|
||||||
|
@ -158,7 +158,7 @@ void V8ClientConnection::createConnection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void V8ClientConnection::setInterrupted(bool interrupted) {
|
void V8ClientConnection::setInterrupted(bool interrupted) {
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (interrupted && connection != nullptr) {
|
if (interrupted && connection != nullptr) {
|
||||||
shutdownConnection();
|
shutdownConnection();
|
||||||
} else if (!interrupted && connection == nullptr) {
|
} else if (!interrupted && connection == nullptr) {
|
||||||
|
@ -167,7 +167,7 @@ void V8ClientConnection::setInterrupted(bool interrupted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool V8ClientConnection::isConnected() const {
|
bool V8ClientConnection::isConnected() const {
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (connection) {
|
if (connection) {
|
||||||
return connection->state() == fuerte::Connection::State::Connected;
|
return connection->state() == fuerte::Connection::State::Connected;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ bool V8ClientConnection::isConnected() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string V8ClientConnection::endpointSpecification() const {
|
std::string V8ClientConnection::endpointSpecification() const {
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (connection) {
|
if (connection) {
|
||||||
return connection->endpoint();
|
return connection->endpoint();
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ void V8ClientConnection::reconnect(ClientFeature* client) {
|
||||||
_builder.authenticationType(fuerte::AuthenticationType::Basic);
|
_builder.authenticationType(fuerte::AuthenticationType::Basic);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto oldConnection = std::atomic_exchange<fuerte::Connection>(&_connection, std::shared_ptr<fuerte::Connection>());
|
auto oldConnection = std::atomic_exchange(&_connection, std::shared_ptr<fuerte::Connection>());
|
||||||
if (oldConnection) {
|
if (oldConnection) {
|
||||||
oldConnection->cancel();
|
oldConnection->cancel();
|
||||||
}
|
}
|
||||||
|
@ -1481,7 +1481,7 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
|
||||||
}
|
}
|
||||||
req->timeout(std::chrono::duration_cast<std::chrono::milliseconds>(_requestTimeout));
|
req->timeout(std::chrono::duration_cast<std::chrono::milliseconds>(_requestTimeout));
|
||||||
|
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
|
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
|
||||||
"not connected");
|
"not connected");
|
||||||
|
@ -1540,7 +1540,7 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
|
||||||
}
|
}
|
||||||
req->timeout(std::chrono::duration_cast<std::chrono::milliseconds>(_requestTimeout));
|
req->timeout(std::chrono::duration_cast<std::chrono::milliseconds>(_requestTimeout));
|
||||||
|
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
|
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
|
||||||
"not connected");
|
"not connected");
|
||||||
|
@ -1823,9 +1823,9 @@ void V8ClientConnection::initServer(v8::Isolate* isolate, v8::Local<v8::Context>
|
||||||
}
|
}
|
||||||
|
|
||||||
void V8ClientConnection::shutdownConnection() {
|
void V8ClientConnection::shutdownConnection() {
|
||||||
auto connection = std::atomic_load<fuerte::Connection>(&_connection);
|
auto connection = std::atomic_load(&_connection);
|
||||||
if (connection) {
|
if (connection) {
|
||||||
connection->cancel();
|
connection->cancel();
|
||||||
std::atomic_store<fuerte::Connection>(&_connection, std::shared_ptr<fuerte::Connection>());
|
std::atomic_store(&_connection, std::shared_ptr<fuerte::Connection>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue