X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fdetail%2FMPMCPipelineDetail.h;h=c436c5f6816337abecb6da67888f7eee35ae161c;hb=461255b2148ebcff1a37c440d32c31e69e15e46a;hp=84312b33af5ed2acb960471e8571a865b38cfd22;hpb=546bd3f5f2ed1fdf3a0f5c2b6737a20c4bc2f561;p=folly.git diff --git a/folly/detail/MPMCPipelineDetail.h b/folly/detail/MPMCPipelineDetail.h index 84312b33..c436c5f6 100644 --- a/folly/detail/MPMCPipelineDetail.h +++ b/folly/detail/MPMCPipelineDetail.h @@ -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. @@ -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