mirror of
https://gitlab.com/niansa/cosched.git
synced 2025-03-06 20:53:26 +01:00
Improved LockGuard nodiscard
This commit is contained in:
parent
fddceb7171
commit
671bdb57be
1 changed files with 1 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
|
|
||||||
namespace CoSched {
|
namespace CoSched {
|
||||||
class LockGuard {
|
class [[nodiscard("Discarding the lock guard will release the lock immediately.")]] LockGuard {
|
||||||
class Mutex *mutex;
|
class Mutex *mutex;
|
||||||
|
|
||||||
void unlock();
|
void unlock();
|
||||||
|
@ -42,7 +42,6 @@ public:
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("Discarding the result of this function will release the lock immediately.")]]
|
|
||||||
AwaitableTask<LockGuard> lock() {
|
AwaitableTask<LockGuard> lock() {
|
||||||
auto& task = Task::get_current();
|
auto& task = Task::get_current();
|
||||||
// Make sure the lock is not already held by same task
|
// Make sure the lock is not already held by same task
|
||||||
|
|
Loading…
Add table
Reference in a new issue