mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Warn when RAII lock returned from function is discarded
Discarding RAII lock returned from function almost always is a bug. This change introduces usage of [[no_discard]] attribute from C++17 to prevent such misues. Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
d672920121
commit
90ba50bf52
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -30,7 +30,7 @@ class WddmResidentAllocationsContainer {
|
||||
MOCKABLE_VIRTUAL void removeResource(const D3DKMT_HANDLE &handle);
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL std::unique_lock<SpinLock> acquireLock(SpinLock &lock) {
|
||||
[[nodiscard]] MOCKABLE_VIRTUAL std::unique_lock<SpinLock> acquireLock(SpinLock &lock) {
|
||||
return std::unique_lock<SpinLock>{lock};
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ class WddmResidencyController {
|
||||
|
||||
static void APIENTRY trimCallback(_Inout_ D3DKMT_TRIMNOTIFICATION *trimNotification);
|
||||
|
||||
MOCKABLE_VIRTUAL std::unique_lock<SpinLock> acquireLock();
|
||||
std::unique_lock<SpinLock> acquireTrimCallbackLock();
|
||||
[[nodiscard]] MOCKABLE_VIRTUAL std::unique_lock<SpinLock> acquireLock();
|
||||
[[nodiscard]] std::unique_lock<SpinLock> acquireTrimCallbackLock();
|
||||
|
||||
WddmAllocation *getTrimCandidateHead();
|
||||
void addToTrimCandidateList(GraphicsAllocation *allocation);
|
||||
|
Reference in New Issue
Block a user