is_prepared = true;
}
- std::unique_lock l{connection->write_lock};
+ std::lock_guard<std::mutex> l(connection->write_lock);
// "features" changes will change the payload encoding
if (can_fast_prepare &&
(can_write == WriteStatus::NOWRITE || connection->get_features() != f)) {
<< dendl;
if (can_write != WriteStatus::REPLACING && !write_in_progress) {
write_in_progress = true;
-
- /* unlock the mutex now because dispatch_event_external() may
- block waiting for another mutex */
- l.unlock();
-
connection->center->dispatch_event_external(connection->write_handler);
}
}
void ProtocolV1::send_keepalive() {
ldout(cct, 10) << __func__ << dendl;
- std::unique_lock l{connection->write_lock};
+ std::lock_guard<std::mutex> l(connection->write_lock);
if (can_write != WriteStatus::CLOSED) {
keepalive = true;
-
- /* unlock the mutex now because dispatch_event_external() may
- block waiting for another mutex */
- l.unlock();
-
connection->center->dispatch_event_external(connection->write_handler);
}
}
is_prepared = false;
}
- std::unique_lock l{connection->write_lock};
+ std::lock_guard<std::mutex> l(connection->write_lock);
// "features" changes will change the payload encoding
if (can_fast_prepare && (!can_write || connection->get_features() != f)) {
// ensure the correctness of message encoding
<< dendl;
if (((!replacing && can_write) || state == STANDBY) && !write_in_progress) {
write_in_progress = true;
-
- /* unlock the mutex now because dispatch_event_external() may
- block waiting for another mutex */
- l.unlock();
-
connection->center->dispatch_event_external(connection->write_handler);
}
}
void ProtocolV2::send_keepalive() {
ldout(cct, 10) << __func__ << dendl;
- std::unique_lock l{connection->write_lock};
+ std::lock_guard<std::mutex> l(connection->write_lock);
if (state != CLOSED) {
keepalive = true;
-
- /* unlock the mutex now because dispatch_event_external() may
- block waiting for another mutex */
- l.unlock();
-
connection->center->dispatch_event_external(connection->write_handler);
}
}