You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wh...@apache.org on 2015/07/11 02:10:03 UTC

[44/46] hadoop git commit: HDFS-8725. Use std::chrono to implement the timer in the asio library. Contributed by Haohui Mai.

HDFS-8725. Use std::chrono to implement the timer in the asio library. Contributed by Haohui Mai.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/53c169a8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/53c169a8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/53c169a8

Branch: refs/heads/HDFS-8707
Commit: 53c169a8690b7a70a9e074eee223014ae51ae4f9
Parents: 5b488f3
Author: Haohui Mai <wh...@apache.org>
Authored: Tue Jul 7 13:25:51 2015 -0700
Committer: Haohui Mai <wh...@apache.org>
Committed: Fri Jul 10 17:08:38 2015 -0700

----------------------------------------------------------------------
 .../src/main/native/libhdfspp/CMakeLists.txt    |  2 +-
 .../include/asio/basic_deadline_timer.hpp       |  2 ++
 .../asio-1.10.2/include/asio/deadline_timer.hpp | 23 ++++++++++++++++++++
 .../include/asio/deadline_timer_service.hpp     |  2 ++
 .../asio-1.10.2/include/asio/time_traits.hpp    |  8 +++++++
 5 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/53c169a8/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/CMakeLists.txt
index 96bbaed..2986b88 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/CMakeLists.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/CMakeLists.txt
@@ -18,7 +18,7 @@
 
 project (libhdfspp)
 
-add_definitions(-DASIO_STANDALONE)
+add_definitions(-DASIO_STANDALONE -DASIO_CPP11_DATE_TIME)
 
 if(UNIX)
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11 -g -fPIC -fno-strict-aliasing")

http://git-wip-us.apache.org/repos/asf/hadoop/blob/53c169a8/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_deadline_timer.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_deadline_timer.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_deadline_timer.hpp
index 6aef75c..d0fc371 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_deadline_timer.hpp
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_deadline_timer.hpp
@@ -18,6 +18,7 @@
 #include "asio/detail/config.hpp"
 
 #if defined(ASIO_HAS_BOOST_DATE_TIME) \
+  || defined(ASIO_CPP11_DATE_TIME) \
   || defined(GENERATING_DOCUMENTATION)
 
 #include <cstddef>
@@ -513,6 +514,7 @@ public:
 #include "asio/detail/pop_options.hpp"
 
 #endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+       // || defined(ASIO_CPP11_DATE_TIME)
        // || defined(GENERATING_DOCUMENTATION)
 
 #endif // ASIO_BASIC_DEADLINE_TIMER_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/53c169a8/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer.hpp
index cf018d0..c0b7fe8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer.hpp
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer.hpp
@@ -18,23 +18,46 @@
 #include "asio/detail/config.hpp"
 
 #if defined(ASIO_HAS_BOOST_DATE_TIME) \
+  || defined(ASIO_CPP11_DATE_TIME) \
   || defined(GENERATING_DOCUMENTATION)
 
 #include "asio/detail/socket_types.hpp" // Must come before posix_time.
 #include "asio/basic_deadline_timer.hpp"
 
+#if defined(ASIO_HAS_BOOST_DATE_TIME)
+
 #include "asio/detail/push_options.hpp"
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include "asio/detail/pop_options.hpp"
 
+#elif defined(ASIO_CPP11_DATE_TIME)
+
+#include "asio/detail/chrono_time_traits.hpp"
+#include "asio/wait_traits.hpp"
+#include <chrono>
+
+#endif
+
 namespace asio {
 
+#if defined(ASIO_HAS_BOOST_DATE_TIME)
 /// Typedef for the typical usage of timer. Uses a UTC clock.
 typedef basic_deadline_timer<boost::posix_time::ptime> deadline_timer;
 
+#elif defined(ASIO_CPP11_DATE_TIME)
+
+typedef basic_deadline_timer<
+    std::chrono::system_clock,
+    detail::chrono_time_traits<std::chrono::system_clock,
+                               wait_traits<std::chrono::system_clock>>>
+    deadline_timer;
+
+#endif
+
 } // namespace asio
 
 #endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+       // || defined(ASIO_CPP11_DATE_TIME)
        // || defined(GENERATING_DOCUMENTATION)
 
 #endif // ASIO_DEADLINE_TIMER_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/53c169a8/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer_service.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer_service.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer_service.hpp
index cac8ef9..990c2e7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer_service.hpp
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/deadline_timer_service.hpp
@@ -18,6 +18,7 @@
 #include "asio/detail/config.hpp"
 
 #if defined(ASIO_HAS_BOOST_DATE_TIME) \
+  || defined(ASIO_CPP11_DATE_TIME) \
   || defined(GENERATING_DOCUMENTATION)
 
 #include <cstddef>
@@ -166,6 +167,7 @@ private:
 #include "asio/detail/pop_options.hpp"
 
 #endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+       // || defined(ASIO_CPP11_DATE_TIME)
        // || defined(GENERATING_DOCUMENTATION)
 
 #endif // ASIO_DEADLINE_TIMER_SERVICE_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/53c169a8/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/time_traits.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/time_traits.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/time_traits.hpp
index b3a5216..1a8c2df 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/time_traits.hpp
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/time_traits.hpp
@@ -18,11 +18,14 @@
 #include "asio/detail/socket_types.hpp" // Must come before posix_time.
 
 #if defined(ASIO_HAS_BOOST_DATE_TIME) \
+  || defined(ASIO_CPP11_DATE_TIME) \
   || defined(GENERATING_DOCUMENTATION)
 
+#if defined(ASIO_HAS_BOOST_DATE_TIME)
 #include "asio/detail/push_options.hpp"
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include "asio/detail/pop_options.hpp"
+#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
 
 #include "asio/detail/push_options.hpp"
 
@@ -32,6 +35,8 @@ namespace asio {
 template <typename Time>
 struct time_traits;
 
+#if defined(ASIO_HAS_BOOST_DATE_TIME)
+
 /// Time traits specialised for posix_time.
 template <>
 struct time_traits<boost::posix_time::ptime>
@@ -78,11 +83,14 @@ struct time_traits<boost::posix_time::ptime>
   }
 };
 
+#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+
 } // namespace asio
 
 #include "asio/detail/pop_options.hpp"
 
 #endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+       // || defined(ASIO_CPP11_DATE_TIME)
        // || defined(GENERATING_DOCUMENTATION)
 
 #endif // ASIO_TIME_TRAITS_HPP