remove boost::thread and boost::mutex code
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index 1ed0bfa..9ea82c3 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -103,14 +103,7 @@
endif()
# WITH_*THREADS selects which threading library to use
-if(WITH_BOOSTTHREADS)
- set( thriftcpp_threads_SOURCES
- src/thrift/concurrency/BoostThreadFactory.cpp
- src/thrift/concurrency/BoostMonitor.cpp
- src/thrift/concurrency/BoostMutex.cpp
- )
- list(APPEND SYSLIBS "${Boost_LIBRARIES}")
-elseif(UNIX AND NOT WITH_STDTHREADS)
+if(UNIX AND NOT WITH_STDTHREADS)
if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
else()
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 83ccd9b..11d6b05 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -106,15 +106,9 @@
src/thrift/server/TThreadPoolServer.cpp \
src/thrift/server/TThreadedServer.cpp
-if WITH_BOOSTTHREADS
-libthrift_la_SOURCES += src/thrift/concurrency/BoostThreadFactory.cpp \
- src/thrift/concurrency/BoostMonitor.cpp \
- src/thrift/concurrency/BoostMutex.cpp
-else
libthrift_la_SOURCES += src/thrift/concurrency/Mutex.cpp \
src/thrift/concurrency/Monitor.cpp \
src/thrift/concurrency/PosixThreadFactory.cpp
-endif
libthriftnb_la_SOURCES = src/thrift/server/TNonblockingServer.cpp \
src/thrift/async/TEvhttpServer.cpp \
@@ -170,7 +164,6 @@
include_concurrencydir = $(include_thriftdir)/concurrency
include_concurrency_HEADERS = \
- src/thrift/concurrency/BoostThreadFactory.h \
src/thrift/concurrency/Exception.h \
src/thrift/concurrency/Mutex.h \
src/thrift/concurrency/Monitor.h \
diff --git a/lib/cpp/src/thrift/concurrency/BoostMonitor.cpp b/lib/cpp/src/thrift/concurrency/BoostMonitor.cpp
deleted file mode 100644
index ebfa0b9..0000000
--- a/lib/cpp/src/thrift/concurrency/BoostMonitor.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <thrift/thrift-config.h>
-
-#include <thrift/concurrency/Monitor.h>
-#include <thrift/concurrency/Exception.h>
-#include <thrift/concurrency/Util.h>
-#include <thrift/transport/PlatformSocket.h>
-#include <thrift/stdcxx.h>
-
-#include <assert.h>
-#include <boost/thread.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-namespace apache {
-namespace thrift {
-namespace concurrency {
-
-/**
- * Monitor implementation using the boost thread library
- *
- * @version $Id:$
- */
-class Monitor::Impl : public boost::condition_variable_any {
-
-public:
- Impl() : ownedMutex_(new Mutex()), mutex_(NULL) { init(ownedMutex_.get()); }
-
- Impl(Mutex* mutex) : mutex_(NULL) { init(mutex); }
-
- Impl(Monitor* monitor) : mutex_(NULL) { init(&(monitor->mutex())); }
-
- Mutex& mutex() { return *mutex_; }
- void lock() { mutex().lock(); }
- void unlock() { mutex().unlock(); }
-
- /**
- * Exception-throwing version of waitForTimeRelative(), called simply
- * wait(int64) for historical reasons. Timeout is in milliseconds.
- *
- * If the condition occurs, this function returns cleanly; on timeout or
- * error an exception is thrown.
- */
- void wait(int64_t timeout_ms) {
- int result = waitForTimeRelative(timeout_ms);
- if (result == THRIFT_ETIMEDOUT) {
- throw TimedOutException();
- } else if (result != 0) {
- throw TException("Monitor::wait() failed");
- }
- }
-
- /**
- * Waits until the specified timeout in milliseconds for the condition to
- * occur, or waits forever if timeout_ms == 0.
- *
- * Returns 0 if condition occurs, THRIFT_ETIMEDOUT on timeout, or an error code.
- */
- int waitForTimeRelative(int64_t timeout_ms) {
- if (timeout_ms == 0LL) {
- return waitForever();
- }
-
- assert(mutex_);
- boost::timed_mutex* mutexImpl
- = reinterpret_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
- assert(mutexImpl);
-
- boost::timed_mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
- int res
- = timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(timeout_ms))
- ? 0
- : THRIFT_ETIMEDOUT;
- lock.release();
- return res;
- }
-
- /**
- * Waits until the absolute time specified using struct THRIFT_TIMESPEC.
- * Returns 0 if condition occurs, THRIFT_ETIMEDOUT on timeout, or an error code.
- */
- int waitForTime(const THRIFT_TIMESPEC* abstime) {
- struct timeval temp;
- temp.tv_sec = static_cast<long>(abstime->tv_sec);
- temp.tv_usec = static_cast<long>(abstime->tv_nsec) / 1000;
- return waitForTime(&temp);
- }
-
- /**
- * Waits until the absolute time specified using struct timeval.
- * Returns 0 if condition occurs, THRIFT_ETIMEDOUT on timeout, or an error code.
- */
- int waitForTime(const struct timeval* abstime) {
- assert(mutex_);
- boost::timed_mutex* mutexImpl = static_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
- assert(mutexImpl);
-
- struct timeval currenttime;
- Util::toTimeval(currenttime, Util::currentTime());
-
- long tv_sec = static_cast<long>(abstime->tv_sec - currenttime.tv_sec);
- long tv_usec = static_cast<long>(abstime->tv_usec - currenttime.tv_usec);
- if (tv_sec < 0)
- tv_sec = 0;
- if (tv_usec < 0)
- tv_usec = 0;
-
- boost::timed_mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
- int res = timed_wait(lock,
- boost::get_system_time() + boost::posix_time::seconds(tv_sec)
- + boost::posix_time::microseconds(tv_usec))
- ? 0
- : THRIFT_ETIMEDOUT;
- lock.release();
- return res;
- }
-
- /**
- * Waits forever until the condition occurs.
- * Returns 0 if condition occurs, or an error code otherwise.
- */
- int waitForever() {
- assert(mutex_);
- boost::timed_mutex* mutexImpl
- = reinterpret_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
- assert(mutexImpl);
-
- boost::timed_mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
- ((boost::condition_variable_any*)this)->wait(lock);
- lock.release();
- return 0;
- }
-
- void notify() { notify_one(); }
-
- void notifyAll() { notify_all(); }
-
-private:
- void init(Mutex* mutex) { mutex_ = mutex; }
-
- stdcxx::scoped_ptr<Mutex> ownedMutex_;
- Mutex* mutex_;
-};
-
-Monitor::Monitor() : impl_(new Monitor::Impl()) {
-}
-Monitor::Monitor(Mutex* mutex) : impl_(new Monitor::Impl(mutex)) {
-}
-Monitor::Monitor(Monitor* monitor) : impl_(new Monitor::Impl(monitor)) {
-}
-
-Monitor::~Monitor() {
- delete impl_;
-}
-
-Mutex& Monitor::mutex() const {
- return const_cast<Monitor::Impl*>(impl_)->mutex();
-}
-
-void Monitor::lock() const {
- const_cast<Monitor::Impl*>(impl_)->lock();
-}
-
-void Monitor::unlock() const {
- const_cast<Monitor::Impl*>(impl_)->unlock();
-}
-
-void Monitor::wait(int64_t timeout) const {
- const_cast<Monitor::Impl*>(impl_)->wait(timeout);
-}
-
-int Monitor::waitForTime(const THRIFT_TIMESPEC* abstime) const {
- return const_cast<Monitor::Impl*>(impl_)->waitForTime(abstime);
-}
-
-int Monitor::waitForTime(const timeval* abstime) const {
- return const_cast<Monitor::Impl*>(impl_)->waitForTime(abstime);
-}
-
-int Monitor::waitForTimeRelative(int64_t timeout_ms) const {
- return const_cast<Monitor::Impl*>(impl_)->waitForTimeRelative(timeout_ms);
-}
-
-int Monitor::waitForever() const {
- return const_cast<Monitor::Impl*>(impl_)->waitForever();
-}
-
-void Monitor::notify() const {
- const_cast<Monitor::Impl*>(impl_)->notify();
-}
-
-void Monitor::notifyAll() const {
- const_cast<Monitor::Impl*>(impl_)->notifyAll();
-}
-}
-}
-} // apache::thrift::concurrency
diff --git a/lib/cpp/src/thrift/concurrency/BoostMutex.cpp b/lib/cpp/src/thrift/concurrency/BoostMutex.cpp
deleted file mode 100644
index 4e556df..0000000
--- a/lib/cpp/src/thrift/concurrency/BoostMutex.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <thrift/thrift-config.h>
-
-#include <thrift/concurrency/Mutex.h>
-#include <thrift/concurrency/Util.h>
-#include <thrift/Thrift.h>
-
-#include <cassert>
-#include <boost/thread.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-namespace apache {
-namespace thrift {
-namespace concurrency {
-
-/**
- * Implementation of Mutex class using boost::timed_mutex
- *
- * Methods throw boost::lock_error on error.
- *
- * @version $Id:$
- */
-class Mutex::impl : public boost::timed_mutex {};
-
-Mutex::Mutex(Initializer init) : impl_(new Mutex::impl()) {
- THRIFT_UNUSED_VARIABLE(init);
-}
-
-void* Mutex::getUnderlyingImpl() const {
- return impl_.get();
-}
-
-void Mutex::lock() const {
- impl_->lock();
-}
-
-bool Mutex::trylock() const {
- return impl_->try_lock();
-}
-
-bool Mutex::timedlock(int64_t ms) const {
- return impl_->timed_lock(boost::get_system_time() + boost::posix_time::milliseconds(ms));
-}
-
-void Mutex::unlock() const {
- impl_->unlock();
-}
-
-void Mutex::DEFAULT_INITIALIZER(void* arg) {
- THRIFT_UNUSED_VARIABLE(arg);
-}
-}
-}
-} // apache::thrift::concurrency
diff --git a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp b/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
deleted file mode 100644
index d7d8d54..0000000
--- a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <thrift/thrift-config.h>
-
-#if USE_BOOST_THREAD
-
-#include <thrift/concurrency/BoostThreadFactory.h>
-#include <thrift/concurrency/Exception.h>
-#include <thrift/stdcxx.h>
-#include <cassert>
-
-#include <boost/thread.hpp>
-
-namespace apache {
-namespace thrift {
-
-using stdcxx::bind;
-using stdcxx::scoped_ptr;
-using stdcxx::shared_ptr;
-using stdcxx::weak_ptr;
-
-namespace concurrency {
-
-/**
- * The boost thread class.
- *
- * @version $Id:$
- */
-class BoostThread : public Thread {
-public:
- enum STATE { uninitialized, starting, started, stopping, stopped };
-
- static void* threadMain(void* arg);
-
-private:
- scoped_ptr<boost::thread> thread_;
- Monitor monitor_;
- STATE state_;
- weak_ptr<BoostThread> self_;
- bool detached_;
-
-public:
- BoostThread(bool detached, shared_ptr<Runnable> runnable)
- : state_(uninitialized), detached_(detached) {
- this->Thread::runnable(runnable);
- }
-
- ~BoostThread() {
- if (!detached_ && thread_->joinable()) {
- try {
- join();
- } catch (...) {
- // We're really hosed.
- }
- }
- }
-
- STATE getState() const
- {
- Synchronized sync(monitor_);
- return state_;
- }
-
- void setState(STATE newState)
- {
- Synchronized sync(monitor_);
- state_ = newState;
-
- // unblock start() with the knowledge that the thread has actually
- // started running, which avoids a race in detached threads.
- if (newState == started) {
- monitor_.notify();
- }
- }
-
- void start() {
- // Create reference
- shared_ptr<BoostThread>* selfRef = new shared_ptr<BoostThread>();
- *selfRef = self_.lock();
-
- setState(starting);
-
- Synchronized sync(monitor_);
-
- thread_.reset(new boost::thread(bind(threadMain, (void*)selfRef)));
-
- if (detached_)
- thread_->detach();
-
- // Wait for the thread to start and get far enough to grab everything
- // that it needs from the calling context, thus absolving the caller
- // from being required to hold on to runnable indefinitely.
- monitor_.wait();
- }
-
- void join() {
- if (!detached_ && getState() != uninitialized) {
- thread_->join();
- }
- }
-
- Thread::id_t getId() { return thread_.get() ? thread_->get_id() : boost::thread::id(); }
-
- shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
-
- void runnable(shared_ptr<Runnable> value) { Thread::runnable(value); }
-
- void weakRef(shared_ptr<BoostThread> self) {
- assert(self.get() == this);
- self_ = weak_ptr<BoostThread>(self);
- }
-};
-
-void* BoostThread::threadMain(void* arg) {
- shared_ptr<BoostThread> thread = *(shared_ptr<BoostThread>*)arg;
- delete reinterpret_cast<shared_ptr<BoostThread>*>(arg);
-
- thread->setState(started);
- thread->runnable()->run();
-
- if (thread->getState() != stopping && thread->getState() != stopped) {
- thread->setState(stopping);
- }
- return (void*)0;
-}
-
-BoostThreadFactory::BoostThreadFactory(bool detached)
- : ThreadFactory(detached) {
-}
-
-shared_ptr<Thread> BoostThreadFactory::newThread(shared_ptr<Runnable> runnable) const {
- shared_ptr<BoostThread> result = shared_ptr<BoostThread>(new BoostThread(isDetached(), runnable));
- result->weakRef(result);
- runnable->thread(result);
- return result;
-}
-
-Thread::id_t BoostThreadFactory::getCurrentThreadId() const {
- return boost::this_thread::get_id();
-}
-}
-}
-} // apache::thrift::concurrency
-
-#endif // USE_BOOST_THREAD
diff --git a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.h b/lib/cpp/src/thrift/concurrency/BoostThreadFactory.h
deleted file mode 100644
index bf11a70..0000000
--- a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef _THRIFT_CONCURRENCY_BOOSTTHREADFACTORY_H_
-#define _THRIFT_CONCURRENCY_BOOSTTHREADFACTORY_H_ 1
-
-#include <thrift/concurrency/Monitor.h>
-#include <thrift/concurrency/Thread.h>
-#include <thrift/stdcxx.h>
-
-namespace apache {
-namespace thrift {
-namespace concurrency {
-
-/**
- * A thread factory to create posix threads
- *
- * @version $Id:$
- */
-class BoostThreadFactory : public ThreadFactory {
-
-public:
- /**
- * Boost thread factory. All threads created by a factory are reference-counted
- * via stdcxx::shared_ptr. The factory guarantees that threads and the Runnable tasks they
- * host will be properly cleaned up once the last strong reference to both is given up.
- *
- * Threads are created with the specified boost policy, priority, stack-size. A detachable thread
- * is not joinable.
- *
- * By default threads are not joinable.
- */
-
- BoostThreadFactory(bool detached = true);
-
- // From ThreadFactory;
- stdcxx::shared_ptr<Thread> newThread(stdcxx::shared_ptr<Runnable> runnable) const;
-
- // From ThreadFactory;
- Thread::id_t getCurrentThreadId() const;
-};
-
-}
-}
-} // apache::thrift::concurrency
-
-#endif // #ifndef _THRIFT_CONCURRENCY_BOOSTTHREADFACTORY_H_
diff --git a/lib/cpp/src/thrift/concurrency/PlatformThreadFactory.h b/lib/cpp/src/thrift/concurrency/PlatformThreadFactory.h
index 545b572..99b4403 100644
--- a/lib/cpp/src/thrift/concurrency/PlatformThreadFactory.h
+++ b/lib/cpp/src/thrift/concurrency/PlatformThreadFactory.h
@@ -22,9 +22,7 @@
// clang-format off
#include <thrift/thrift-config.h>
-#if USE_BOOST_THREAD
-# include <thrift/concurrency/BoostThreadFactory.h>
-#elif USE_STD_THREAD
+#if USE_STD_THREAD
# include <thrift/concurrency/StdThreadFactory.h>
#else
# include <thrift/concurrency/PosixThreadFactory.h>
@@ -36,9 +34,7 @@
namespace concurrency {
// clang-format off
-#if USE_BOOST_THREAD
- typedef BoostThreadFactory PlatformThreadFactory;
-#elif USE_STD_THREAD
+#if USE_STD_THREAD
typedef StdThreadFactory PlatformThreadFactory;
#else
typedef PosixThreadFactory PlatformThreadFactory;
diff --git a/lib/cpp/src/thrift/concurrency/Thread.h b/lib/cpp/src/thrift/concurrency/Thread.h
index 788623b..7e2d251 100644
--- a/lib/cpp/src/thrift/concurrency/Thread.h
+++ b/lib/cpp/src/thrift/concurrency/Thread.h
@@ -25,9 +25,7 @@
#include <thrift/thrift-config.h>
-#if USE_BOOST_THREAD
-#include <boost/thread.hpp>
-#elif USE_STD_THREAD
+#if USE_STD_THREAD
#include <thread>
#else
#ifdef HAVE_PTHREAD_H
@@ -80,12 +78,7 @@
class Thread {
public:
-#if USE_BOOST_THREAD
- typedef boost::thread::id id_t;
-
- static inline bool is_current(id_t t) { return t == boost::this_thread::get_id(); }
- static inline id_t get_current() { return boost::this_thread::get_id(); }
-#elif USE_STD_THREAD
+#if USE_STD_THREAD
typedef std::thread::id id_t;
static inline bool is_current(id_t t) { return t == std::this_thread::get_id(); }
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index 194d59f..1031ec0 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -1119,7 +1119,7 @@
// Launch all the secondary IO threads in separate threads
if (ioThreads_.size() > 1) {
ioThreadFactory_.reset(new PlatformThreadFactory(
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
PlatformThreadFactory::OTHER, // scheduler
PlatformThreadFactory::NORMAL, // priority
1, // stack size (MB)
diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
index 2e0ccf5..d2683b0 100644
--- a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
+++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
@@ -28,13 +28,7 @@
namespace transport {
TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(NULL);
-#if USE_BOOST_THREAD
-boost::once_flag TWinsockSingleton::flags_ = BOOST_ONCE_INIT;
-#elif USE_STD_THREAD
std::once_flag TWinsockSingleton::flags_;
-#else
-#error For windows you must choose USE_BOOST_THREAD or USE_STD_THREAD
-#endif
//------------------------------------------------------------------------------
TWinsockSingleton::TWinsockSingleton(void) {
@@ -55,11 +49,7 @@
//------------------------------------------------------------------------------
void TWinsockSingleton::create(void) {
-#if USE_BOOST_THREAD
- boost::call_once(init, flags_);
-#elif USE_STD_THREAD
std::call_once(flags_, init);
-#endif
}
//------------------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.h b/lib/cpp/src/thrift/windows/TWinsockSingleton.h
index 0eab6d4..50458a9 100644
--- a/lib/cpp/src/thrift/windows/TWinsockSingleton.h
+++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.h
@@ -33,13 +33,7 @@
// boost
#include <boost/noncopyable.hpp>
-#if USE_BOOST_THREAD
-#include <boost/thread/once.hpp>
-#elif USE_STD_THREAD
#include <mutex>
-#else
-#error For windows you must choose USE_BOOST_THREAD or USE_STD_THREAD
-#endif
#include <thrift/stdcxx.h>
@@ -70,13 +64,7 @@
private:
static instance_ptr instance_ptr_;
-#if USE_BOOST_THREAD
- static boost::once_flag flags_;
-#elif USE_STD_THREAD
static std::once_flag flags_;
-#else
-#error Need a non-Boost non-C++11 way to track single initialization here.
-#endif
};
}
}
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index bc4aa42..a5f4457 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -31,9 +31,6 @@
// use std::thread in MSVC11 (2012) or newer and in MinGW
#if (_MSC_VER >= 1700) || defined(__MINGW32__)
#define USE_STD_THREAD 1
-#else
-// otherwise use boost threads
-#define USE_BOOST_THREAD 1
#endif
// Something that defines PRId64 is required to build
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index 261382f..82d47a6 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -82,7 +82,7 @@
TServerTransportTest.cpp
)
-if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW)
+if(NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW)
list(APPEND UnitTest_SOURCES concurrency/MutexTest.cpp)
list(APPEND UnitTest_SOURCES concurrency/RWMutexStarveTest.cpp)
endif()
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index 4b9f77d..d645a65 100755
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -135,11 +135,9 @@
TServerTransportTest.cpp \
TTransportCheckThrow.h
-if !WITH_BOOSTTHREADS
UnitTests_SOURCES += \
concurrency/MutexTest.cpp \
concurrency/RWMutexStarveTest.cpp
-endif
UnitTests_LDADD = \
libtestgencpp.la \
diff --git a/lib/cpp/test/TNonblockingSSLServerTest.cpp b/lib/cpp/test/TNonblockingSSLServerTest.cpp
index 3e9700f..2efb140 100644
--- a/lib/cpp/test/TNonblockingSSLServerTest.cpp
+++ b/lib/cpp/test/TNonblockingSSLServerTest.cpp
@@ -221,7 +221,7 @@
apache::thrift::stdcxx::scoped_ptr<apache::thrift::concurrency::ThreadFactory> threadFactory(
new apache::thrift::concurrency::PlatformThreadFactory(
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
concurrency::PlatformThreadFactory::OTHER, concurrency::PlatformThreadFactory::NORMAL,
1,
#endif
diff --git a/lib/cpp/test/TNonblockingServerTest.cpp b/lib/cpp/test/TNonblockingServerTest.cpp
index 63d8a04..5e10907 100644
--- a/lib/cpp/test/TNonblockingServerTest.cpp
+++ b/lib/cpp/test/TNonblockingServerTest.cpp
@@ -148,7 +148,7 @@
shared_ptr<ThreadFactory> threadFactory(
new PlatformThreadFactory(
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
PlatformThreadFactory::OTHER, PlatformThreadFactory::NORMAL,
1,
#endif
diff --git a/lib/cpp/test/concurrency/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h
index 9ecd6ba..15a43ff 100644
--- a/lib/cpp/test/concurrency/ThreadManagerTests.h
+++ b/lib/cpp/test/concurrency/ThreadManagerTests.h
@@ -111,7 +111,7 @@
shared_ptr<PlatformThreadFactory> threadFactory
= shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory(false));
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
threadFactory->setPriority(PosixThreadFactory::HIGHEST);
#endif
threadManager->threadFactory(threadFactory);
@@ -260,7 +260,7 @@
shared_ptr<PlatformThreadFactory> threadFactory
= shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
threadFactory->setPriority(PosixThreadFactory::HIGHEST);
#endif
threadManager->threadFactory(threadFactory);
@@ -401,7 +401,7 @@
return false;
}
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
// test once with a detached thread factory and once with a joinable thread factory
shared_ptr<PosixThreadFactory> threadFactory
@@ -426,7 +426,7 @@
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(1);
threadManager->threadFactory(threadFactory);
-#if !USE_BOOST_THREAD && !USE_STD_THREAD
+#if !USE_STD_THREAD
threadFactory->setPriority(PosixThreadFactory::HIGHEST);
// verify we cannot change the thread factory to one with the opposite detached setting