X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fdetail%2FMPMCPipelineDetail.h;h=36a66307b3c1db6c113fb801054e562004b6f289;hp=e34a0c9c6fccb00b8a6d3090bf6ee25f132e9ae7;hb=cd1bdc912603c0358ba733d379a74ae90ab3a437;hpb=22afce906d7e98d95f8c45c3301072d9fd891d41 diff --git a/folly/detail/MPMCPipelineDetail.h b/folly/detail/MPMCPipelineDetail.h index e34a0c9c..36a66307 100644 --- a/folly/detail/MPMCPipelineDetail.h +++ b/folly/detail/MPMCPipelineDetail.h @@ -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 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 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::writeCount; only works for the first stage @@ -122,5 +117,5 @@ struct AmplificationProduct> { AmplificationProduct>::value; }; -}} // namespaces - +} // namespace detail +} // namespace folly