Skip to content

Commit b37a234

Browse files
authored
[SYCL] Reinitialize moved containers (#2648)
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent 9edab41 commit b37a234

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sycl/source/detail/queue_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
215215
vector_class<event> USMEvents;
216216
{
217217
std::lock_guard<mutex_class> Lock(MMutex);
218-
Events = std::move(MEventsWeak);
219-
USMEvents = std::move(MEventsShared);
218+
Events.swap(MEventsWeak);
219+
USMEvents.swap(MEventsShared);
220220
}
221221

222222
for (std::weak_ptr<event_impl> &EventImplWeakPtr : Events)

sycl/source/detail/queue_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class queue_impl {
226226
exception_list Exceptions;
227227
{
228228
std::lock_guard<mutex_class> Lock(MMutex);
229-
Exceptions = std::move(MExceptions);
229+
std::swap(Exceptions, MExceptions);
230230
}
231231
// Unlock the mutex before calling user-provided handler to avoid
232232
// potential deadlock if the same queue is somehow referenced in the

0 commit comments

Comments
 (0)