From: Yedidya Feldblum Date: Sat, 6 May 2017 04:15:35 +0000 (-0700) Subject: Mark future-core get-state members as const noexcept X-Git-Tag: v2017.05.08.00~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c822472ddbe39a4516056f5063360846a0eb60e0;p=folly.git Mark future-core get-state members as const noexcept Summary: [Folly] Mark future-core get-state members as `const noexcept`. Reviewed By: andrewjcg Differential Revision: D5014358 fbshipit-source-id: e39b0b63c59267a4ecfab5aac02e6d96ce2e7e00 --- diff --git a/folly/futures/Promise-inl.h b/folly/futures/Promise-inl.h index 620890ee..c55d34ca 100644 --- a/folly/futures/Promise-inl.h +++ b/folly/futures/Promise-inl.h @@ -134,7 +134,7 @@ void Promise::setWith(F&& func) { } template -bool Promise::isFulfilled() { +bool Promise::isFulfilled() const noexcept { if (core_) { return core_->hasResult(); } diff --git a/folly/futures/Promise.h b/folly/futures/Promise.h index 43cb07db..a2793e29 100644 --- a/folly/futures/Promise.h +++ b/folly/futures/Promise.h @@ -27,7 +27,7 @@ template class Future; template class Promise { -public: + public: Promise(); ~Promise(); @@ -93,9 +93,9 @@ public: template void setWith(F&& func); - bool isFulfilled(); + bool isFulfilled() const noexcept; -private: + private: typedef typename Future::corePtr corePtr; template friend class Future; diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index 0e66d330..790a45cd 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -101,7 +101,7 @@ class Core final { Core& operator=(Core&&) = delete; /// May call from any thread - bool hasResult() const { + bool hasResult() const noexcept { switch (fsm_.getState()) { case State::OnlyResult: case State::Armed: @@ -115,7 +115,7 @@ class Core final { } /// May call from any thread - bool ready() const { + bool ready() const noexcept { return hasResult(); } diff --git a/folly/futures/detail/FSM.h b/folly/futures/detail/FSM.h index 27e035c5..fc3bb117 100644 --- a/folly/futures/detail/FSM.h +++ b/folly/futures/detail/FSM.h @@ -43,7 +43,7 @@ private: public: explicit FSM(Enum startState) : state_(startState) {} - Enum getState() const { + Enum getState() const noexcept { return state_.load(std::memory_order_acquire); }