summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp')
-rw-r--r--3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp184
1 files changed, 96 insertions, 88 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp
index 70342e3..2c84e5a 100644
--- a/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp
+++ b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp
@@ -2,7 +2,7 @@
// detail/impl/handler_tracking.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 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)
@@ -23,13 +23,21 @@
#include <cstdio>
#include <boost/asio/detail/handler_tracking.hpp>
-#include <boost/asio/detail/push_options.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include <boost/asio/detail/pop_options.hpp>
-
-#if !defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
+# include <boost/asio/time_traits.hpp>
+#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
+# if defined(BOOST_ASIO_HAS_STD_CHRONO)
+# include <chrono>
+# elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+# include <boost/chrono/system_clocks.hpp>
+# endif
+# include <boost/asio/detail/chrono_time_traits.hpp>
+# include <boost/asio/wait_traits.hpp>
+#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
+
+#if !defined(BOOST_ASIO_WINDOWS)
# include <unistd.h>
-#endif // !defined(BOOST_WINDOWS)
+#endif // !defined(BOOST_ASIO_WINDOWS)
#include <boost/asio/detail/push_options.hpp>
@@ -37,10 +45,37 @@ namespace boost {
namespace asio {
namespace detail {
+struct handler_tracking_timestamp
+{
+ uint64_t seconds;
+ uint64_t microseconds;
+
+ handler_tracking_timestamp()
+ {
+#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+#elif defined(BOOST_ASIO_HAS_STD_CHRONO)
+ typedef chrono_time_traits<std::chrono::system_clock,
+ boost::asio::wait_traits<std::chrono::system_clock> > traits_helper;
+ traits_helper::posix_time_duration now(
+ std::chrono::system_clock::now().time_since_epoch());
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+ typedef chrono_time_traits<boost::chrono::system_clock,
+ boost::asio::wait_traits<boost::chrono::system_clock> > traits_helper;
+ traits_helper::posix_time_duration now(
+ boost::chrono::system_clock::now().time_since_epoch());
+#endif
+ seconds = static_cast<uint64_t>(now.total_seconds());
+ microseconds = static_cast<uint64_t>(now.total_microseconds() % 1000000);
+ }
+};
+
struct handler_tracking::tracking_state
{
static_mutex mutex_;
- boost::uint64_t next_id_;
+ uint64_t next_id_;
tss_ptr<completion>* current_completion_;
};
@@ -70,22 +105,19 @@ void handler_tracking::creation(handler_tracking::tracked_handler* h,
h->id_ = state->next_id_++;
lock.unlock();
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
- boost::uint64_t current_id = 0;
+ uint64_t current_id = 0;
if (completion* current_completion = *state->current_completion_)
current_id = current_completion->id_;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|%llu*%llu|%.20s@%p.%.50s\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
current_id, h->id_, object_type, object, op_name);
}
@@ -101,18 +133,15 @@ handler_tracking::completion::~completion()
{
if (id_)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|%c%I64u|\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|%c%llu|\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
invoked_ ? '!' : '~', id_);
}
@@ -121,18 +150,15 @@ handler_tracking::completion::~completion()
void handler_tracking::completion::invocation_begin()
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|>%I64u|\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_);
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds, id_);
invoked_ = true;
}
@@ -140,18 +166,15 @@ void handler_tracking::completion::invocation_begin()
void handler_tracking::completion::invocation_begin(
const boost::system::error_code& ec)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
id_, ec.category().name(), ec.value());
invoked_ = true;
@@ -160,20 +183,17 @@ void handler_tracking::completion::invocation_begin(
void handler_tracking::completion::invocation_begin(
const boost::system::error_code& ec, std::size_t bytes_transferred)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,bytes_transferred=%I64u\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,bytes_transferred=%llu\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
id_, ec.category().name(), ec.value(),
- static_cast<boost::uint64_t>(bytes_transferred));
+ static_cast<uint64_t>(bytes_transferred));
invoked_ = true;
}
@@ -181,18 +201,15 @@ void handler_tracking::completion::invocation_begin(
void handler_tracking::completion::invocation_begin(
const boost::system::error_code& ec, int signal_number)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,signal_number=%d\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,signal_number=%d\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
id_, ec.category().name(), ec.value(), signal_number);
invoked_ = true;
@@ -201,18 +218,15 @@ void handler_tracking::completion::invocation_begin(
void handler_tracking::completion::invocation_begin(
const boost::system::error_code& ec, const char* arg)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,%.50s\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,%.50s\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
id_, ec.category().name(), ec.value(), arg);
invoked_ = true;
@@ -222,18 +236,15 @@ void handler_tracking::completion::invocation_end()
{
if (id_)
{
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|<%I64u|\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|<%llu|\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_);
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds, id_);
id_ = 0;
}
@@ -244,22 +255,19 @@ void handler_tracking::operation(const char* object_type,
{
static tracking_state* state = get_state();
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration now =
- boost::posix_time::microsec_clock::universal_time() - epoch;
+ handler_tracking_timestamp timestamp;
unsigned long long current_id = 0;
if (completion* current_completion = *state->current_completion_)
current_id = current_completion->id_;
write_line(
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
"@asio|%I64u.%06I64u|%I64u|%.20s@%p.%.50s\n",
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
"@asio|%llu.%06llu|%llu|%.20s@%p.%.50s\n",
-#endif // defined(BOOST_WINDOWS)
- static_cast<boost::uint64_t>(now.total_seconds()),
- static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+#endif // defined(BOOST_ASIO_WINDOWS)
+ timestamp.seconds, timestamp.microseconds,
current_id, object_type, object, op_name);
}
@@ -271,21 +279,21 @@ void handler_tracking::write_line(const char* format, ...)
va_start(args, format);
char line[256] = "";
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+#if defined(BOOST_ASIO_HAS_SECURE_RTL)
int length = vsprintf_s(line, sizeof(line), format, args);
-#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+#else // defined(BOOST_ASIO_HAS_SECURE_RTL)
int length = vsprintf(line, format, args);
-#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+#endif // defined(BOOST_ASIO_HAS_SECURE_RTL)
va_end(args);
-#if defined(BOOST_WINDOWS)
+#if defined(BOOST_ASIO_WINDOWS)
HANDLE stderr_handle = ::GetStdHandle(STD_ERROR_HANDLE);
DWORD bytes_written = 0;
::WriteFile(stderr_handle, line, length, &bytes_written, 0);
-#else // defined(BOOST_WINDOWS)
+#else // defined(BOOST_ASIO_WINDOWS)
::write(STDERR_FILENO, line, length);
-#endif // defined(BOOST_WINDOWS)
+#endif // defined(BOOST_ASIO_WINDOWS)
}
} // namespace detail