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

Let test_once be noexcept

Summary: [Folly] Let `test_once` be `noexcept` since it is required not to fail.

Reviewed By: andriigrynenko, luciang

Differential Revision: D18742588

fbshipit-source-id: fda78057d10fca1521ee6335f7c7758d05c43b88
parent ea216b9b
...@@ -66,7 +66,8 @@ call_once(basic_once_flag<Mutex, Atom>& flag, F&& f, Args&&... args) { ...@@ -66,7 +66,8 @@ call_once(basic_once_flag<Mutex, Atom>& flag, F&& f, Args&&... args) {
// //
// Note: This has no parallel in the std::once_flag interface. // Note: This has no parallel in the std::once_flag interface.
template <typename Mutex, template <typename> class Atom> template <typename Mutex, template <typename> class Atom>
FOLLY_ALWAYS_INLINE bool test_once(basic_once_flag<Mutex, Atom> const& flag) { FOLLY_ALWAYS_INLINE bool test_once(
basic_once_flag<Mutex, Atom> const& flag) noexcept {
return flag.called_.load(std::memory_order_acquire); return flag.called_.load(std::memory_order_acquire);
} }
...@@ -91,7 +92,7 @@ class basic_once_flag { ...@@ -91,7 +92,7 @@ class basic_once_flag {
friend void call_once(basic_once_flag<Mutex_, Atom_>&, F&&, Args&&...); friend void call_once(basic_once_flag<Mutex_, Atom_>&, F&&, Args&&...);
template <typename Mutex_, template <typename> class Atom_> template <typename Mutex_, template <typename> class Atom_>
friend bool test_once(basic_once_flag<Mutex_, Atom_> const& flag); friend bool test_once(basic_once_flag<Mutex_, Atom_> const& flag) noexcept;
template <typename F, typename... Args> template <typename F, typename... Args>
FOLLY_ALWAYS_INLINE void call_once(F&& f, Args&&... args) { FOLLY_ALWAYS_INLINE void call_once(F&& f, Args&&... args) {
......
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