Skip to content

Commit ece826a

Browse files
authored
[SYCL] Fix warning caused by [[nodiscard]] attribute (#2545)
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.
1 parent 1291215 commit ece826a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sycl/source/detail/scheduler/scheduler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ void Scheduler::lockSharedTimedMutex(
269269
// access occurs after shared access.
270270
// TODO: after switching to C++17, change std::shared_timed_mutex to
271271
// std::shared_mutex and use std::lock_guard here both for Windows and Linux.
272-
while (!Lock.owns_lock()) {
273-
Lock.try_lock_for(std::chrono::milliseconds(10));
272+
while (!Lock.try_lock_for(std::chrono::milliseconds(10))) {
274273
// Without yield while loop acts like endless while loop and occupies the
275274
// whole CPU when multiple command groups are created in multiple host
276275
// threads

0 commit comments

Comments
 (0)