#define __STDC_LIMIT_MACROS
#define __STDC_FORMAT_MACROS
#include <stdio.h>
+#ifndef _WIN32
#include <inttypes.h>
+#else
+#include <stdint.h>
+#endif
#include <limits.h>
#include "main.h"
#include "globals.h"
if test "x[$]ENABLE_BOOSTTHREADS" = "x1"; then
AC_MSG_WARN(enable boostthreads)
AC_DEFINE([USE_BOOST_THREAD], [1], [experimental --enable-boostthreads that replaces POSIX pthread by boost::thread])
+ LIBS="-lboost_thread $LIBS"
fi
AM_CONDITIONAL([WITH_BOOSTTHREADS], [test "x[$]ENABLE_BOOSTTHREADS" = "x1"])
lib_LTLIBRARIES = libthrift.la
pkgconfig_DATA = thrift.pc
-libthrift_la_LDFLAGS = -release $(VERSION)
+libthrift_la_LDFLAGS = -release $(VERSION) $(BOOST_LDFLAGS)
## We only build the extra libraries if we have the dependencies,
## but we install all of the headers unconditionally.
libthriftz_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CPPFLAGS)
libthriftnb_la_CXXFLAGS = $(AM_CXXFLAGS)
libthriftz_la_CXXFLAGS = $(AM_CXXFLAGS)
-libthriftnb_la_LDFLAGS = -release $(VERSION)
-libthriftz_la_LDFLAGS = -release $(VERSION)
-
-if WITH_BOOSTTHREADS
-libthrift_la_LIBADD = -lboost_thread
-endif
+libthriftnb_la_LDFLAGS = -release $(VERSION) $(BOOST_LDFLAGS)
+libthriftz_la_LDFLAGS = -release $(VERSION) $(BOOST_LDFLAGS)
include_thriftdir = $(includedir)/thrift
include_thrift_HEADERS = \
#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
-#include <boost/interprocess/sync/interprocess_condition.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
namespace apache { namespace thrift { namespace concurrency {
-using namespace boost::interprocess;
-
/**
- * Monitor implementation using the boost interprocess library
+ * Monitor implementation using the boost thread library
*
* @version $Id:$
*/
-class Monitor::Impl : public interprocess_condition {
+class Monitor::Impl : public boost::condition_variable_any {
public:
}
assert(mutex_);
- interprocess_mutex* mutexImpl =
- reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+ boost::timed_mutex* mutexImpl =
+ reinterpret_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
assert(mutexImpl);
- scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
+ 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 : ETIMEDOUT;
lock.release();
return res;
*/
int waitForTime(const timespec* abstime) {
assert(mutex_);
- interprocess_mutex* mutexImpl =
- reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+ boost::timed_mutex* mutexImpl =
+ reinterpret_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
assert(mutexImpl);
struct timespec currenttime;
if(tv_nsec < 0)
tv_nsec = 0;
- scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
+ 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_nsec / 1000)
*/
int waitForever() {
assert(mutex_);
- interprocess_mutex* mutexImpl =
- reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+ boost::timed_mutex* mutexImpl =
+ reinterpret_cast<boost::timed_mutex*>(mutex_->getUnderlyingImpl());
assert(mutexImpl);
- scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
- ((interprocess_condition*)this)->wait(lock);
+ boost::timed_mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
+ ((boost::condition_variable_any*)this)->wait(lock);
lock.release();
return 0;
}
#include <cassert>
#include <boost/thread.hpp>
+#include <boost/thread/mutex.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
-
-using namespace boost::interprocess;
namespace apache { namespace thrift { namespace concurrency {
*
* @version $Id:$
*/
-class Mutex::impl : public interprocess_mutex {
+class Mutex::impl : public boost::timed_mutex {
};
Mutex::Mutex(Initializer init) : impl_(new Mutex::impl()) {}
}
// TSSLSocket implementation
-TSSLSocket::TSSLSocket(shared_ptr<SSLContext> ctx):
+TSSLSocket::TSSLSocket(boost::shared_ptr<SSLContext> ctx):
TSocket(), server_(false), ssl_(NULL), ctx_(ctx) {
}
-TSSLSocket::TSSLSocket(shared_ptr<SSLContext> ctx, int socket):
+TSSLSocket::TSSLSocket(boost::shared_ptr<SSLContext> ctx, int socket):
TSocket(socket), server_(false), ssl_(NULL), ctx_(ctx) {
}
-TSSLSocket::TSSLSocket(shared_ptr<SSLContext> ctx, string host, int port):
+TSSLSocket::TSSLSocket(boost::shared_ptr<SSLContext> ctx, string host, int port):
TSocket(host, port), server_(false), ssl_(NULL), ctx_(ctx) {
}
randomize();
}
count_++;
- ctx_ = shared_ptr<SSLContext>(new SSLContext);
+ ctx_ = boost::shared_ptr<SSLContext>(new SSLContext);
}
TSSLSocketFactory::~TSSLSocketFactory() {
}
}
-shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket() {
- shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_));
+boost::shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket() {
+ boost::shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_));
setup(ssl);
return ssl;
}
-shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket(int socket) {
- shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_, socket));
+boost::shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket(int socket) {
+ boost::shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_, socket));
setup(ssl);
return ssl;
}
-shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket(const string& host,
+boost::shared_ptr<TSSLSocket> TSSLSocketFactory::createSocket(const string& host,
int port) {
- shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_, host, port));
+ boost::shared_ptr<TSSLSocket> ssl(new TSSLSocket(ctx_, host, port));
setup(ssl);
return ssl;
}
-void TSSLSocketFactory::setup(shared_ptr<TSSLSocket> ssl) {
+void TSSLSocketFactory::setup(boost::shared_ptr<TSSLSocket> ssl) {
ssl->server(server());
if (access_ == NULL && !server()) {
- access_ = shared_ptr<AccessManager>(new DefaultClientAccessManager);
+ access_ = boost::shared_ptr<AccessManager>(new DefaultClientAccessManager);
}
if (access_ != NULL) {
ssl->access(access_);
TBufferBaseTest.cpp
UnitTests_LDADD = \
- $(BOOST_LDFLAGS) \
libtestgencpp.la \
$(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
-I$(top_srcdir)/lib/cpp/src
AM_CPPFLAGS = $(BOOST_CPPFLAGS)
+AM_LDFLAGS = $(BOOST_LDFLAGS)
AM_CXXFLAGS = -Wall
clean-local: