Skip to content

Commit acada7e

Browse files
Apply more comments
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
1 parent f0794e9 commit acada7e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

sycl/source/detail/program_impl.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <algorithm>
1717
#include <fstream>
18+
#include <list>
1819
#include <memory>
1920
#include <mutex>
2021

@@ -42,16 +43,8 @@ program_impl::program_impl(
4243

4344
// Sort the programs to avoid deadlocks due to locking multiple mutexes &
4445
// verify that all programs are unique.
45-
std::sort(ProgramList.begin(), ProgramList.end(),
46-
[](const shared_ptr_class<program_impl> &A,
47-
const shared_ptr_class<program_impl> &B) {
48-
return A.get() < B.get();
49-
});
50-
auto It = std::unique(ProgramList.begin(), ProgramList.end(),
51-
[](const shared_ptr_class<program_impl> &A,
52-
const shared_ptr_class<program_impl> &B) {
53-
return A.get() == B.get();
54-
});
46+
std::sort(ProgramList.begin(), ProgramList.end());
47+
auto It = std::unique(ProgramList.begin(), ProgramList.end());
5548
if (It != ProgramList.end()) {
5649
throw runtime_error("Attempting to link a program with itself",
5750
PI_INVALID_PROGRAM);
@@ -64,9 +57,9 @@ program_impl::program_impl(
6457
DevicesSorted = sort_devices_by_cl_device_id(MDevices);
6558
}
6659
check_device_feature_support<info::device::is_linker_available>(MDevices);
67-
vector_class<unique_ptr_class<std::lock_guard<std::mutex>>> Locks;
60+
std::list<std::lock_guard<std::mutex>> Locks;
6861
for (const auto &Prg : ProgramList) {
69-
Locks.emplace_back(new std::lock_guard<std::mutex>(Prg->MMutex));
62+
Locks.emplace_back(Prg->MMutex);
7063
Prg->throw_if_state_is_not(program_state::compiled);
7164
if (Prg->MContext != MContext) {
7265
throw invalid_object_error(

0 commit comments

Comments
 (0)