Fix lock around deleting causinganalysis to hang

This commit is contained in:
Isaac Connor
2025-04-24 08:15:18 +05:30
parent cb23ce65e8
commit 6e6b3d097b

View File

@@ -419,7 +419,10 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
} // end voidPacketQueue::clearPackets(ZMPacket* zm_packet)
void PacketQueue::stop() {
deleting = true;
{
std::unique_lock<std::mutex> lck(mutex);
deleting = true;
}
condition.notify_all();
for (const auto &p : pktQueue) {
p->notify_all();
@@ -544,7 +547,7 @@ ZMPacketLock PacketQueue::get_packet(packetqueue_iterator *it) {
Debug(2, "waiting on packet %d. Queue size %zu it == end? %d", p->image_index, pktQueue.size(), (*it == pktQueue.end()));
condition.wait(lck);
} // end while !lp
} // end while ! deleting or zm_terminate
} // end scope for lock
Debug(1, "terminated, leaving");