From b06ad031984f522ed806447d972f273a7702cd52 Mon Sep 17 00:00:00 2001 From: Artur Gainullin Date: Fri, 25 Sep 2020 12:54:46 -0700 Subject: [PATCH] [SYCL] Fix warning caused by [[nodiscard]] attribute try_lock_for method is marked with [[nodiscard]] attribute which means that its result can't be discarded. Discarding the result causes warning which turns into error in -Werror mode causing build failure. --- sycl/source/detail/scheduler/scheduler.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/source/detail/scheduler/scheduler.cpp b/sycl/source/detail/scheduler/scheduler.cpp index 8c67225b7b98b..c2a0c3fbbb509 100644 --- a/sycl/source/detail/scheduler/scheduler.cpp +++ b/sycl/source/detail/scheduler/scheduler.cpp @@ -269,8 +269,7 @@ void Scheduler::lockSharedTimedMutex( // access occurs after shared access. // TODO: after switching to C++17, change std::shared_timed_mutex to // std::shared_mutex and use std::lock_guard here both for Windows and Linux. - while (!Lock.owns_lock()) { - Lock.try_lock_for(std::chrono::milliseconds(10)); + while (!Lock.try_lock_for(std::chrono::milliseconds(10))) { // Without yield while loop acts like endless while loop and occupies the // whole CPU when multiple command groups are created in multiple host // threads