From d53c9bd610465476ad267cddd45112664046f3d3 Mon Sep 17 00:00:00 2001 From: Ameya Limaye Date: Wed, 2 Nov 2016 18:01:53 -0700 Subject: [PATCH] Allow getting the sequence number of a token via a read only getter function Summary: Allow getting the sequence number of a token via a read only getter function Reviewed By: yfeldblum Differential Revision: D4120900 fbshipit-source-id: b664dda29d13a1755e041ab9c33c0d7324690ba7 --- folly/fibers/AtomicBatchDispatcher-inl.h | 5 +++++ folly/fibers/AtomicBatchDispatcher.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/folly/fibers/AtomicBatchDispatcher-inl.h b/folly/fibers/AtomicBatchDispatcher-inl.h index 7427bd56..9bfcd239 100644 --- a/folly/fibers/AtomicBatchDispatcher-inl.h +++ b/folly/fibers/AtomicBatchDispatcher-inl.h @@ -148,6 +148,11 @@ AtomicBatchDispatcher::Token::Token( size_t sequenceNumber) : baton_(std::move(baton)), sequenceNumber_(sequenceNumber) {} +template +size_t AtomicBatchDispatcher::Token::sequenceNumber() const { + return sequenceNumber_; +} + template Future AtomicBatchDispatcher::Token::dispatch( InputT input) { diff --git a/folly/fibers/AtomicBatchDispatcher.h b/folly/fibers/AtomicBatchDispatcher.h index 7b1db369..591902a9 100644 --- a/folly/fibers/AtomicBatchDispatcher.h +++ b/folly/fibers/AtomicBatchDispatcher.h @@ -147,6 +147,8 @@ class AtomicBatchDispatcher { Token(Token&&) = default; Token& operator=(Token&&) = default; + size_t sequenceNumber() const; + private: // Disallow copying a Token object Token(const Token&) = delete; -- 2.34.1