From 671bdb57be67ee2b8838070e4676a81cb5c043c6 Mon Sep 17 00:00:00 2001 From: niansa Date: Mon, 22 May 2023 23:57:49 +0200 Subject: [PATCH] Improved LockGuard nodiscard --- include/scheduler_mutex.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/scheduler_mutex.hpp b/include/scheduler_mutex.hpp index 0b1a38f..a7fda54 100644 --- a/include/scheduler_mutex.hpp +++ b/include/scheduler_mutex.hpp @@ -6,7 +6,7 @@ namespace CoSched { -class LockGuard { +class [[nodiscard("Discarding the lock guard will release the lock immediately.")]] LockGuard { class Mutex *mutex; void unlock(); @@ -42,7 +42,6 @@ public: unlock(); } - [[nodiscard("Discarding the result of this function will release the lock immediately.")]] AwaitableTask lock() { auto& task = Task::get_current(); // Make sure the lock is not already held by same task