Skip to content

Commit f776fd2

Browse files
authored
gloo/ibverbs: Buffer cleanup handlers on teardown
Differential Revision: D74892988 Pull Request resolved: #442
1 parent 4854c8d commit f776fd2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

gloo/transport/ibverbs/buffer.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,20 @@ Buffer::Buffer(Pair* pair, int slot, void* ptr, size_t size)
5959
}
6060

6161
Buffer::~Buffer() {
62-
std::lock_guard<std::mutex> lock(m_);
63-
if (sendPending_ > 0) {
64-
GLOO_WARN(
65-
"Destructing buffer with pending sends, sendPending_=", sendPending_);
66-
}
62+
{
63+
std::lock_guard<std::mutex> lock(m_);
64+
if (sendPending_ > 0) {
65+
GLOO_WARN(
66+
"Destructing buffer with pending sends, sendPending_=", sendPending_);
67+
}
6768

68-
ibv_dereg_mr(mr_);
69+
ibv_dereg_mr(mr_);
70+
}
71+
{
72+
std::lock_guard<std::mutex> lock(pair_->m_);
73+
pair_->sendCompletionHandlers_[slot_].clear();
74+
pair_->recvCompletionHandlers_[slot_].clear();
75+
}
6976
}
7077

7178
// Wait for a receive operation to finish.

0 commit comments

Comments
 (0)