Fix copyright lines
[folly.git] / folly / detail / MPMCPipelineDetail.h
index e34a0c9c6fccb00b8a6d3090bf6ee25f132e9ae7..36a66307b3c1db6c113fb801054e562004b6f289 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2013-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include "folly/MPMCQueue.h"
+#include <folly/MPMCQueue.h>
 
 namespace folly {
 
@@ -76,8 +76,8 @@ class MPMCPipelineStageImpl {
   }
 
   uint64_t blockingRead(T& elem) noexcept {
-    uint64_t ticket = queue_.popTicket_++;
-    queue_.dequeueWithTicket(ticket, elem);
+    uint64_t ticket;
+    queue_.blockingReadWithTicket(ticket, elem);
     return ticket;
   }
 
@@ -87,12 +87,7 @@ class MPMCPipelineStageImpl {
 
   template <class... Args>
   bool readAndGetTicket(uint64_t& ticket, T& elem) noexcept {
-    if (queue_.tryObtainReadyPopTicket(ticket)) {
-      queue_.dequeueWithTicket(ticket, elem);
-      return true;
-    } else {
-      return false;
-    }
+    return queue_.readAndGetTicket(ticket, elem);
   }
 
   // See MPMCQueue<T>::writeCount; only works for the first stage
@@ -122,5 +117,5 @@ struct AmplificationProduct<std::tuple<T, Ts...>> {
     AmplificationProduct<std::tuple<Ts...>>::value;
 };
 
-}}  // namespaces
-
+} // namespace detail
+} // namespace folly