From c51404e07420dcc2e3c1f28a72a04395ccdcb39f Mon Sep 17 00:00:00 2001 From: Reece Date: Fri, 24 Dec 2021 17:04:13 +0000 Subject: [PATCH] [+] Added AU_TRY_LOCK_GUARD_NAMED --- Include/Aurora/Threading/LockGuardTry.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Include/Aurora/Threading/LockGuardTry.hpp b/Include/Aurora/Threading/LockGuardTry.hpp index 84b65360..d12b6992 100644 --- a/Include/Aurora/Threading/LockGuardTry.hpp +++ b/Include/Aurora/Threading/LockGuardTry.hpp @@ -86,8 +86,10 @@ namespace Aurora::Threading }; #define AU_TRY_LOCK_GUARD(variable) Aurora::Threading::TryLockGuard AU_CONCAT(__stack_lock, __COUNTER__) (variable); - #define AU_TRY_LOCK_GUARD_RET_(variable, value, counter) Aurora::Threading::TryLockGuard AU_CONCAT(__stack_lock, counter) (variable); if (!(AU_CONCAT(__stack_lock, counter).Locked())) return value; - #define AU_TRY_LOCK_GUARD_RET_VAL(variable, value) AU_TRY_LOCK_GUARD_RET_(variable, value, AU_WHAT(__COUNTER__)) + #define AU_TRY_LOCK_GUARD_RET_NAMED(variable, value, name) Aurora::Threading::TryLockGuard name (variable); if (!(name.Locked())) return value; + #define AU_TRY_LOCK_GUARD_RET(variable, value, counter) AU_TRY_LOCK_GUARD_RET_NAMED(variable, value, AU_CONCAT(__stack_lock, counter)) + #define AU_TRY_LOCK_GUARD_RET_VAL(variable, value) AU_TRY_LOCK_GUARD_RET_NAMED(variable, value, AU_WHAT(__COUNTER__)) #define AU_TRY_LOCK_GUARD_RET_DEF(variable) AU_TRY_LOCK_GUARD_RET_VAL(variable, {}) #define AU_TRY_LOCK_GUARD_RET(variable) AU_TRY_LOCK_GUARD_RET_VAL(variable, ) -} \ No newline at end of file + #define AU_TRY_LOCK_GUARD_NAMED(variable, name) AU_TRY_LOCK_GUARD_RET_NAMED(variable, , name) +}2 \ No newline at end of file