diff --git a/configure.ac b/configure.ac index 3582dfd0..f9b70122 100644 --- a/configure.ac +++ b/configure.ac @@ -162,23 +162,6 @@ auto tp = std::chrono::steady_clock::now(); AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -# Check that std::future is available. -AC_MSG_CHECKING([whether std::future is available]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[ -#include -#include -]], -[[ -std::vector> v; -]])], - [AC_DEFINE([HAVE_STD_FUTURE], [1], - [Define to 1 if you have the `std::future`.]) - have_std_future=yes - AC_MSG_RESULT([yes])], - [have_std_future=no - AC_MSG_RESULT([no])]) - AC_LANG_POP() # Checks for libraries. @@ -369,7 +352,6 @@ if test "x${request_app}" = "xyes" && fi AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ]) -AM_CONDITIONAL([ENABLE_H2LOAD], [ test "x${have_std_future}" = "xyes" ]) enable_hpack_tools=no # HPACK tools requires jansson diff --git a/src/Makefile.am b/src/Makefile.am index 15dfd698..6d481330 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -78,8 +78,6 @@ nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \ ssl.cc ssl.h \ HttpServer.cc HttpServer.h -if ENABLE_H2LOAD - bin_PROGRAMS += h2load h2load_SOURCES = util.cc util.h libevent_util.cc libevent_util.h \ @@ -93,8 +91,6 @@ if HAVE_SPDYLAY h2load_SOURCES += h2load_spdy_session.cc h2load_spdy_session.h endif # HAVE_SPDYLAY -endif # ENABLE_H2LOAD - NGHTTPX_SRCS = \ util.cc util.h http2.cc http2.h timegm.c timegm.h base64.h \ libevent_util.cc libevent_util.h \ diff --git a/src/h2load.cc b/src/h2load.cc index c11fcd4f..f60ffeaf 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -577,15 +577,6 @@ std::string get_reqline(const char *uri, const http_parser_url& u) } } // namespace -namespace { -Stats run(std::unique_ptr worker) -{ - worker->run(); - - return worker->stats; -} -} // namespace - namespace { int client_select_next_proto_cb(SSL* ssl, unsigned char **out, unsigned char *outlen, @@ -931,10 +922,10 @@ int main(int argc, char **argv) std::cout << "starting benchmark..." << std::endl; - std::vector> futures; auto start = std::chrono::steady_clock::now(); - std::vector> workers; +#ifndef NOTHREADS + std::vector> futures; for(size_t i = 0; i < config.nthreads - 1; ++i) { auto nreqs = nreqs_per_thread + (nreqs_rem-- > 0); auto nclients = nclients_per_thread + (nclients_rem-- > 0); @@ -944,8 +935,17 @@ int main(int argc, char **argv) << std::endl; auto worker = util::make_unique(i, ssl_ctx, nreqs, nclients, &config); - futures.push_back(std::async(std::launch::async, run, std::move(worker))); + futures.push_back + (std::async(std::launch::async, + [](std::unique_ptr worker) + { + worker->run(); + + return worker->stats; + }, std::move(worker))); } +#endif // NOTHREADS + auto nreqs_last = nreqs_per_thread + (nreqs_rem-- > 0); auto nclients_last = nclients_per_thread + (nclients_rem-- > 0); std::cout << "spawning thread #" << (config.nthreads - 1) << ": " @@ -956,6 +956,7 @@ int main(int argc, char **argv) &config); worker.run(); +#ifndef NOTHREADS for(auto& fut : futures) { auto stats = fut.get(); @@ -973,6 +974,7 @@ int main(int argc, char **argv) worker.stats.status[i] += stats.status[i]; } } +#endif // NOTHREADS auto end = std::chrono::steady_clock::now(); auto duration =