Skip to content

Commit 8751ad8

Browse files
committed
fix deadlock
Signed-off-by: Byoungro So <[email protected]>
1 parent 1f9be1d commit 8751ad8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sycl/source/detail/pi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,12 @@ void fillPlatformAndDeviceCache(plugin &Plugin) {
652652
filterDeviceFilter(PiDevices, PiPlatform, Plugin, DeviceNum);
653653

654654
if (PiDevices.size() != 0) {
655-
const std::lock_guard<std::mutex> Guard(
656-
GlobalHandler::instance().getPlatformMapMutex());
657655
std::vector<DeviceImplPtr> DeviceCache;
658656
for (const RT::PiDevice &PiDevice : PiDevices) {
659657
std::shared_ptr<device_impl> Device =
660658
PlatformImpl->getOrMakeDeviceImpl(PiDevice, PlatformImpl);
659+
const std::lock_guard<std::mutex> Guard(
660+
GlobalHandler::instance().getPlatformMapMutex());
661661
DeviceCache.emplace_back(Device);
662662
}
663663

0 commit comments

Comments
 (0)