Skip to content

Commit

Permalink
Removed creation of copy of the shared_ptr in its own destructor (#8488)
Browse files Browse the repository at this point in the history
  • Loading branch information
parthash0804 authored Oct 3, 2024
1 parent 7cc0a85 commit 3970d68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,7 @@ namespace xdp {

void PLDeadlockPlugin::flushDevice(void* hwCtxImpl)
{
xrt::hw_context hwContext = xrt_core::hw_context_int::create_hw_context_from_implementation(hwCtxImpl);
auto coreDevice = xrt_core::hw_context_int::get_core_device(hwContext);

auto handle = coreDevice->get_device_handle();

uint64_t deviceId = db->addDevice(util::getDebugIpLayoutPath(handle));
uint64_t deviceId = mHwCtxImplToDevIdMap[hwCtxImpl];

mThreadCtrlMap[deviceId] = false;
auto it = mThreadMap.find(deviceId);
Expand All @@ -181,6 +176,7 @@ namespace xdp {
mThreadMap.erase(it);
mThreadCtrlMap.erase(deviceId);
}
mHwCtxImplToDevIdMap.erase(hwCtxImpl);
}

void PLDeadlockPlugin::updateDevice(void* hwCtxImpl)
Expand All @@ -191,6 +187,7 @@ namespace xdp {
auto handle = coreDevice->get_device_handle();

uint64_t deviceId = db->addDevice(util::getDebugIpLayoutPath(handle));
mHwCtxImplToDevIdMap[hwCtxImpl] = deviceId;

auto it = mThreadMap.find(deviceId);
if (it != mThreadMap.end()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace xdp {

std::map<uint64_t, std::thread> mThreadMap;
std::map<uint64_t,std::atomic<bool>> mThreadCtrlMap;
std::unordered_map<void*, uint64_t> mHwCtxImplToDevIdMap;
// std::map<void*, std::thread> mThreadMap;
// std::map<void*,std::atomic<bool>> mThreadCtrlMap;
std::mutex mWriteLock;
Expand Down

0 comments on commit 3970d68

Please sign in to comment.