We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45d5061 commit c4fc58eCopy full SHA for c4fc58e
include/ylt/thirdparty/async_simple/coro/SpinLock.h
@@ -60,11 +60,14 @@ class SpinLock {
60
}
61
62
63
- void unlock() noexcept { _locked.store(false, std::memory_order_release); }
+ void unlock() noexcept {
64
+ assert(_locked.load(std::memory_order_acquire) == true);
65
+ _locked.store(false, std::memory_order_release);
66
+ }
67
- Lazy<std::unique_lock<SpinLock>> coScopedLock() {
- co_await coLock();
- co_return std::unique_lock<SpinLock>{*this, std::adopt_lock};
68
+ [[nodiscard]] Lazy<std::unique_lock<SpinLock>> coScopedLock() {
69
+ co_await coLock();
70
+ co_return std::unique_lock<SpinLock>{*this, std::adopt_lock};
71
72
73
private:
0 commit comments