From 7b27c1106d77f27808639336610caeaf49f5274c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 18 Apr 2024 21:13:39 +0200 Subject: Avoid using std::deque with incomplete type Only some containers are allowed by the standard to be declared with incomplete types, deque is not, for vector it is ok. --- src/message.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/message.cpp') diff --git a/src/message.cpp b/src/message.cpp index 349accb..cda2fa7 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -520,13 +520,15 @@ void DirectMessageService::doSyncWithPeers() continue; } - auto & [ thread, peer ] = peerSyncQueue.front(); + decltype(peerSyncQueue) queue; + std::swap(queue, peerSyncQueue); + lock.unlock(); - doSyncWithPeer(thread, peer); + for (auto & [ thread, peer ] : queue) + doSyncWithPeer(thread, peer); lock.lock(); - peerSyncQueue.pop_front(); } } -- cgit v1.2.3