CHECK_FUNCTION_EXISTS(pwritev HAVE_PWRITEV)
CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES("boost/random/discrete_distribution.hpp" HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION)
+CHECK_INCLUDE_FILE_CXX("boost/asio/coroutine.hpp" HAVE_BOOST_ASIO_COROUTINE)
CHECK_INCLUDE_FILES("dirent.h" HAVE_DIRENT_H)
CHECK_INCLUDE_FILES("dlfcn.h" HAVE_DLFCN_H)
CHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
[AC_DEFINE([HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION], [], [have boost::random::discrete_distribution])],
[])
+AC_CHECK_HEADER([boost/asio/coroutine.hpp],
+ [AC_DEFINE([HAVE_BOOST_ASIO_COROUTINE], [], [have boost::asio::coroutine])],
+ [])
AC_CHECK_HEADER([boost/statechart/state.hpp], [],
AC_MSG_FAILURE(["Can't find boost statechart headers; need 1.34 or later"]))
AC_CHECK_HEADER([boost/regex.hpp], [],
cls_log_client cls_statelog_client cls_timeindex_client cls_version_client
cls_replica_log_client cls_user_client curl global expat)
+ if(HAVE_BOOST_ASIO_COROUTINE)
+ target_compile_definitions(rgw_a PUBLIC "HAVE_BOOST_ASIO_COROUTINE")
+ endif()
+
set(radosgw_srcs
rgw/rgw_resolve.cc
rgw/rgw_rest.cc
cls_log_client cls_statelog_client cls_timeindex_client
cls_version_client cls_replica_log_client cls_user_client
curl expat global fcgi resolv ${BLKID_LIBRARIES} ${ALLOC_LIBS})
+
install(TARGETS radosgw-admin DESTINATION bin)
add_executable(radosgw-object-expirer ${radosgw_object_expirer_srcs} $<TARGET_OBJECTS:heap_profiler_objs>)
rgw/rgw_keystone.h \
rgw/rgw_realm_watcher.h \
rgw/rgw_civetweb.h \
+ rgw/rgw_boost_asio_coroutine.h \
+ rgw/rgw_boost_asio_yield.h \
rgw/rgw_civetweb_log.h \
rgw/rgw_website.h \
rgw/rgw_rest_s3website.h \
--- /dev/null
+//
+// copy of needed class and macors from coroutine.hpp
+//
+// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef RGW_BOOST_ASIO_COROUTINE_H
+#define RGW_BOOST_ASIO_COROUTINE_H
+
+#ifndef HAVE_BOOST_ASIO_COROUTINE
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class coroutine_ref;
+
+} // namespace detail
+
+class coroutine
+{
+public:
+ /// Constructs a coroutine in its initial state.
+ coroutine() : value_(0) {}
+
+ /// Returns true if the coroutine is the child of a fork.
+ bool is_child() const { return value_ < 0; }
+
+ /// Returns true if the coroutine is the parent of a fork.
+ bool is_parent() const { return !is_child(); }
+
+ /// Returns true if the coroutine has reached its terminal state.
+ bool is_complete() const { return value_ == -1; }
+
+private:
+ friend class detail::coroutine_ref;
+ int value_;
+};
+
+
+namespace detail {
+
+class coroutine_ref
+{
+public:
+ coroutine_ref(coroutine& c) : value_(c.value_), modified_(false) {}
+ coroutine_ref(coroutine* c) : value_(c->value_), modified_(false) {}
+ ~coroutine_ref() { if (!modified_) value_ = -1; }
+ operator int() const { return value_; }
+ int& operator=(int v) { modified_ = true; return value_ = v; }
+private:
+ void operator=(const coroutine_ref&);
+ int& value_;
+ bool modified_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#endif // HAVE_BOOST_ASIO_COROUTINE
+
+#endif // RGW_BOOST_ASIO_COROUTINE_H
+
--- /dev/null
+//
+// copy of needed macors from yield.hpp
+//
+// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef RGW_BOOST_ASIO_YIELD_H
+#define RGW_BOOST_ASIO_YIELD_H
+
+#ifdef HAVE_BOOST_ASIO_COROUTINE
+#include <boost/asio/yield.hpp>
+#else
+#define BOOST_ASIO_CORO_REENTER(c) \
+ switch (::boost::asio::detail::coroutine_ref _coro_value = c) \
+ case -1: if (_coro_value) \
+ { \
+ goto terminate_coroutine; \
+ terminate_coroutine: \
+ _coro_value = -1; \
+ goto bail_out_of_coroutine; \
+ bail_out_of_coroutine: \
+ break; \
+ } \
+ else case 0:
+
+#define BOOST_ASIO_CORO_YIELD_IMPL(n) \
+ for (_coro_value = (n);;) \
+ if (_coro_value == 0) \
+ { \
+ case (n): ; \
+ break; \
+ } \
+ else \
+ switch (_coro_value ? 0 : 1) \
+ for (;;) \
+ case -1: if (_coro_value) \
+ goto terminate_coroutine; \
+ else for (;;) \
+ case 1: if (_coro_value) \
+ goto bail_out_of_coroutine; \
+ else case 0:
+
+#define BOOST_ASIO_CORO_FORK_IMPL(n) \
+ for (_coro_value = -(n);; _coro_value = (n)) \
+ if (_coro_value == (n)) \
+ { \
+ case -(n): ; \
+ break; \
+ } \
+ else
+
+#if defined(_MSC_VER)
+# define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__COUNTER__ + 1)
+# define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__COUNTER__ + 1)
+#else // defined(_MSC_VER)
+# define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__LINE__)
+# define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__LINE__)
+#endif // defined(_MSC_VER)
+
+#ifndef reenter
+# define reenter(c) BOOST_ASIO_CORO_REENTER(c)
+#endif
+
+#ifndef yield
+# define yield BOOST_ASIO_CORO_YIELD
+#endif
+
+#ifndef fork
+# define fork BOOST_ASIO_CORO_FORK
+#endif
+
+#endif // HAVE_BOOST_ASIO_COROUTINE
+
+#endif // RGW_BOOST_ASIO_YIELD_H
+
#include "rgw_coroutine.h"
+#include "rgw_boost_asio_yield.h"
-#include <boost/asio/yield.hpp>
#define dout_subsys ceph_subsys_rgw
#include "common/Timer.h"
#include "rgw_common.h"
+#include "rgw_boost_asio_coroutine.h"
#define RGW_ASYNC_OPS_MGR_WINDOW 100
};
+
class RGWCoroutine : public RefCountedObject, public boost::asio::coroutine {
friend class RGWCoroutinesStack;
#include "rgw_rados.h"
#include "rgw_coroutine.h"
+#include "rgw_boost_asio_yield.h"
#include "rgw_cr_rados.h"
#include "cls/lock/cls_lock_client.h"
-#include <boost/asio/yield.hpp>
-
-
#define dout_subsys ceph_subsys_rgw
bool RGWAsyncRadosProcessor::RGWWQ::_enqueue(RGWAsyncRadosRequest *req) {
#include "rgw_http_client.h"
#include "rgw_bucket.h"
#include "rgw_metadata.h"
+#include "rgw_boost_asio_yield.h"
#include "cls/lock/cls_lock_client.h"
-#include <boost/asio/yield.hpp>
-
-
#define dout_subsys ceph_subsys_rgw
static string datalog_sync_status_oid_prefix = "datalog.sync-status";
#include "rgw_cr_rados.h"
#include "rgw_cr_rest.h"
#include "rgw_http_client.h"
+#include "rgw_boost_asio_yield.h"
#include "cls/lock/cls_lock_client.h"
-#include <boost/asio/yield.hpp>
-
-
#define dout_subsys ceph_subsys_rgw
static string mdlog_sync_status_oid = "mdlog.sync-status";