Commit c822472d authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

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
parent 613033ba
...@@ -134,7 +134,7 @@ void Promise<T>::setWith(F&& func) { ...@@ -134,7 +134,7 @@ void Promise<T>::setWith(F&& func) {
} }
template <class T> template <class T>
bool Promise<T>::isFulfilled() { bool Promise<T>::isFulfilled() const noexcept {
if (core_) { if (core_) {
return core_->hasResult(); return core_->hasResult();
} }
......
...@@ -27,7 +27,7 @@ template <class T> class Future; ...@@ -27,7 +27,7 @@ template <class T> class Future;
template <class T> template <class T>
class Promise { class Promise {
public: public:
Promise(); Promise();
~Promise(); ~Promise();
...@@ -93,9 +93,9 @@ public: ...@@ -93,9 +93,9 @@ public:
template <class F> template <class F>
void setWith(F&& func); void setWith(F&& func);
bool isFulfilled(); bool isFulfilled() const noexcept;
private: private:
typedef typename Future<T>::corePtr corePtr; typedef typename Future<T>::corePtr corePtr;
template <class> friend class Future; template <class> friend class Future;
......
...@@ -101,7 +101,7 @@ class Core final { ...@@ -101,7 +101,7 @@ class Core final {
Core& operator=(Core&&) = delete; Core& operator=(Core&&) = delete;
/// May call from any thread /// May call from any thread
bool hasResult() const { bool hasResult() const noexcept {
switch (fsm_.getState()) { switch (fsm_.getState()) {
case State::OnlyResult: case State::OnlyResult:
case State::Armed: case State::Armed:
...@@ -115,7 +115,7 @@ class Core final { ...@@ -115,7 +115,7 @@ class Core final {
} }
/// May call from any thread /// May call from any thread
bool ready() const { bool ready() const noexcept {
return hasResult(); return hasResult();
} }
......
...@@ -43,7 +43,7 @@ private: ...@@ -43,7 +43,7 @@ private:
public: public:
explicit FSM(Enum startState) : state_(startState) {} explicit FSM(Enum startState) : state_(startState) {}
Enum getState() const { Enum getState() const noexcept {
return state_.load(std::memory_order_acquire); return state_.load(std::memory_order_acquire);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment