2017
[folly.git] / folly / detail / MemoryIdler.h
index cbb846128e866d549627d34a62610e95784f194f..324afac4f0e9837aeedfbf19bab0bc982c08259e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,7 @@
  * limitations under the License.
  */
 
-#ifndef FOLLY_DETAIL_MEMORYIDLER_H
-#define FOLLY_DETAIL_MEMORYIDLER_H
+#pragma once
 
 #include <atomic>
 #include <chrono>
@@ -23,6 +22,7 @@
 #include <folly/Hash.h>
 #include <folly/Traits.h>
 #include <folly/detail/Futex.h>
+#include <folly/portability/PThread.h>
 
 namespace folly {
 
@@ -93,7 +93,7 @@ struct MemoryIdler {
       // multiplying the duration by a floating point doesn't work, grr..
       auto extraFrac =
         timeoutVariationFrac / std::numeric_limits<uint64_t>::max() * h;
-      uint64_t tics = idleTimeout.count() * (1 + extraFrac);
+      auto tics = uint64_t(idleTimeout.count() * (1 + extraFrac));
       idleTimeout = typename Clock::duration(tics);
     }
 
@@ -149,5 +149,3 @@ struct MemoryIdler {
 };
 
 }} // namespace folly::detail
-
-#endif