Skip to content

Commit

Permalink
fix async-simple no discard when call spinlock::coScopedLock
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Jan 20, 2025
1 parent 45d5061 commit 2aefad4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/ylt/thirdparty/async_simple/coro/SpinLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class SpinLock {

void unlock() noexcept { _locked.store(false, std::memory_order_release); }

Lazy<std::unique_lock<SpinLock>> coScopedLock() {
co_await coLock();
co_return std::unique_lock<SpinLock>{*this, std::adopt_lock};
[[nodiscard]] Lazy<std::unique_lock<SpinLock>> coScopedLock() {
co_await coLock();
co_return std::unique_lock<SpinLock>{*this, std::adopt_lock};
}

private:
Expand Down

0 comments on commit 2aefad4

Please sign in to comment.