15
15
16
16
#include < algorithm>
17
17
#include < fstream>
18
+ #include < list>
18
19
#include < memory>
19
20
#include < mutex>
20
21
@@ -42,16 +43,8 @@ program_impl::program_impl(
42
43
43
44
// Sort the programs to avoid deadlocks due to locking multiple mutexes &
44
45
// 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 ());
55
48
if (It != ProgramList.end ()) {
56
49
throw runtime_error (" Attempting to link a program with itself" ,
57
50
PI_INVALID_PROGRAM);
@@ -64,9 +57,9 @@ program_impl::program_impl(
64
57
DevicesSorted = sort_devices_by_cl_device_id (MDevices);
65
58
}
66
59
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;
68
61
for (const auto &Prg : ProgramList) {
69
- Locks.emplace_back (new std::lock_guard<std::mutex>( Prg->MMutex ) );
62
+ Locks.emplace_back (Prg->MMutex );
70
63
Prg->throw_if_state_is_not (program_state::compiled);
71
64
if (Prg->MContext != MContext) {
72
65
throw invalid_object_error (
0 commit comments