projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(Wangle) Fix possible race in updating FSM state
[folly.git]
/
folly
/
futures
/
detail
/
FSM.h
diff --git
a/folly/futures/detail/FSM.h
b/folly/futures/detail/FSM.h
index ce77c551173637f85efe3f8624432c577b172056..b706ed04503e414ed780985a14dee70b980c564d 100644
(file)
--- a/
folly/futures/detail/FSM.h
+++ b/
folly/futures/detail/FSM.h
@@
-55,12
+55,12
@@
public:
if (!mutex_.try_lock()) {
mutex_.lock();
}
if (!mutex_.try_lock()) {
mutex_.lock();
}
- if (state_.load(std::memory_order_
relaxed
) != A) {
+ if (state_.load(std::memory_order_
acquire
) != A) {
mutex_.unlock();
return false;
}
action();
mutex_.unlock();
return false;
}
action();
- state_.store(B, std::memory_order_rel
axed
);
+ state_.store(B, std::memory_order_rel
ease
);
mutex_.unlock();
return true;
}
mutex_.unlock();
return true;
}