replace boost::atomic with std::atomic
diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.h b/lib/cpp/src/thrift/server/TThreadPoolServer.h
index a957b47..121998c 100644
--- a/lib/cpp/src/thrift/server/TThreadPoolServer.h
+++ b/lib/cpp/src/thrift/server/TThreadPoolServer.h
@@ -20,7 +20,7 @@
#ifndef _THRIFT_SERVER_TTHREADPOOLSERVER_H_
#define _THRIFT_SERVER_TTHREADPOOLSERVER_H_ 1
-#include <boost/atomic.hpp>
+#include <atomic>
#include <thrift/concurrency/ThreadManager.h>
#include <thrift/server/TServerFramework.h>
@@ -90,8 +90,8 @@
virtual void onClientDisconnected(TConnectedClient* pClient) /* override */;
std::shared_ptr<apache::thrift::concurrency::ThreadManager> threadManager_;
- boost::atomic<int64_t> timeout_;
- boost::atomic<int64_t> taskExpiration_;
+ std::atomic<int64_t> timeout_;
+ std::atomic<int64_t> taskExpiration_;
};
}
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.h b/lib/cpp/src/thrift/transport/TFileTransport.h
index 4fbdd9e..6cc7bd2 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.h
+++ b/lib/cpp/src/thrift/transport/TFileTransport.h
@@ -24,11 +24,10 @@
#include <thrift/Thrift.h>
#include <thrift/TProcessor.h>
+#include <atomic>
#include <string>
#include <stdio.h>
-#include <boost/atomic.hpp>
-
#include <thrift/concurrency/Mutex.h>
#include <thrift/concurrency/Monitor.h>
#include <thrift/concurrency/PlatformThreadFactory.h>
@@ -347,11 +346,11 @@
// conditions used to block when the buffer is full or empty
Monitor notFull_, notEmpty_;
- boost::atomic<bool> closing_;
+ std::atomic<bool> closing_;
// To keep track of whether the buffer has been flushed
Monitor flushed_;
- boost::atomic<bool> forceFlush_;
+ std::atomic<bool> forceFlush_;
// Mutex that is grabbed when enqueueing and swapping the read/write buffers
Mutex mutex_;
diff --git a/lib/cpp/test/TServerIntegrationTest.cpp b/lib/cpp/test/TServerIntegrationTest.cpp
index 3723679..7976c8b 100644
--- a/lib/cpp/test/TServerIntegrationTest.cpp
+++ b/lib/cpp/test/TServerIntegrationTest.cpp
@@ -18,8 +18,8 @@
*/
#define BOOST_TEST_MODULE TServerIntegrationTest
+#include <atomic>
#include <boost/test/auto_unit_test.hpp>
-#include <boost/atomic.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
@@ -310,10 +310,10 @@
shared_ptr<TProtocol> pProtocol(new TBinaryProtocol(pSocket));
ParentServiceClient client(pProtocol);
pSocket->open();
- bStressConnectionCount.fetch_add(1, boost::memory_order_relaxed);
+ bStressConnectionCount.fetch_add(1, std::memory_order_relaxed);
for (int i = 0; i < rand() % 1000; ++i) {
client.incrementGeneration();
- bStressRequestCount.fetch_add(1, boost::memory_order_relaxed);
+ bStressRequestCount.fetch_add(1, std::memory_order_relaxed);
}
}
}
@@ -321,9 +321,9 @@
shared_ptr<TServerType> pServer;
shared_ptr<TServerReadyEventHandler> pEventHandler;
shared_ptr<boost::thread> pServerThread;
- boost::atomic<bool> bStressDone;
- boost::atomic_int64_t bStressConnectionCount;
- boost::atomic_int64_t bStressRequestCount;
+ std::atomic<bool> bStressDone;
+ std::atomic<int64_t> bStressConnectionCount;
+ std::atomic<int64_t> bStressRequestCount;
};
template <class TServerType>