From 16b77dd10ce320d1121cd4b09f88b36dc459d52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Fri, 1 Mar 2024 22:31:02 -0500 Subject: [PATCH] remove mutex template Change-Id: I0aacf47c70a0de4fcd1a68f6688cf0ee0c551934 --- bin/jni/videomanager.i | 2 +- src/data_transfer.cpp | 4 +- src/jamidht/contact_list.cpp | 6 +-- src/jamidht/conversation.cpp | 24 ++++----- src/jamidht/conversation_module.cpp | 54 +++++++++---------- src/jamidht/jamiaccount.cpp | 24 ++++----- src/jamidht/swarm/swarm_manager.cpp | 6 +-- src/logger.cpp | 2 +- src/manager.cpp | 2 +- src/media/audio/alsa/alsalayer.cpp | 4 +- src/media/audio/audio_input.cpp | 2 +- src/media/audio/audiolayer.h | 2 +- src/media/audio/jack/jacklayer.cpp | 2 +- src/media/audio/opensl/audio_player.cpp | 4 +- src/media/audio/opensl/opensllayer.cpp | 2 +- src/media/audio/portaudio/portaudiolayer.cpp | 2 +- src/media/audio/pulseaudio/audiostream.cpp | 2 +- src/media/audio/pulseaudio/pulselayer.cpp | 10 ++-- src/media/audio/ringbuffer.cpp | 2 +- src/media/media_decoder.cpp | 2 +- src/media/media_recorder.cpp | 2 +- src/media/socket_pair.cpp | 8 +-- src/media/video/sinkclient.cpp | 2 +- src/media/video/video_mixer.cpp | 2 +- src/media/video/video_mixer.h | 4 +- src/scheduled_executor.cpp | 2 +- src/sip/siptransport.cpp | 2 +- src/threadloop.h | 6 +-- test/agent/src/bindings/signal.cpp | 4 +- test/fuzzing/examples/fuzz-channel.cpp | 2 +- test/fuzzing/examples/fuzz-jami-version.cpp | 2 +- .../fuzzing/examples/fuzz-random-over-tls.cpp | 2 +- test/fuzzing/lib/utils.cpp | 4 +- .../fuzzing/scenarios/classic-alice-and-bob.h | 2 +- .../account_archive/account_archive.cpp | 6 +-- test/unitTest/account_archive/migration.cpp | 6 +-- .../account_factory/testAccount_factory.cpp | 2 +- test/unitTest/call/call.cpp | 18 +++---- test/unitTest/call/conference.cpp | 2 +- test/unitTest/call/recorder.cpp | 2 +- test/unitTest/call/sipcall.cpp | 2 +- test/unitTest/common.cpp | 4 +- test/unitTest/conversation/call.cpp | 2 +- test/unitTest/conversation/conversation.cpp | 2 +- .../conversation/conversationFetchSent.cpp | 2 +- .../conversation/conversationMembersEvent.cpp | 2 +- .../conversation/conversationRequest.cpp | 6 +-- test/unitTest/conversation/typers.cpp | 2 +- test/unitTest/fileTransfer/fileTransfer.cpp | 2 +- test/unitTest/ice/ice.cpp | 10 ++-- test/unitTest/ice/ice_sdp_parser.cpp | 12 ++--- test/unitTest/media/test_media_player.cpp | 2 +- .../media_negotiation/auto_answer.cpp | 14 ++--- .../media_negotiation/hold_resume.cpp | 12 ++--- .../media_negotiation/media_negotiation.cpp | 16 +++--- test/unitTest/namedirectory/namedirectory.cpp | 14 ++--- test/unitTest/plugins/plugins.cpp | 8 +-- test/unitTest/presence/presence.cpp | 2 +- test/unitTest/revoke/revoke.cpp | 4 +- test/unitTest/scheduler.cpp | 2 +- test/unitTest/sip_account/sip_basic_calls.cpp | 10 ++-- test/unitTest/sip_account/sip_srtp.cpp | 10 ++-- test/unitTest/swarm/bootstrap.cpp | 8 +-- test/unitTest/swarm/routing_table.cpp | 6 +-- test/unitTest/swarm/swarm_conversation.cpp | 4 +- test/unitTest/swarm/swarm_spread.cpp | 8 +-- test/unitTest/syncHistory/syncHistory.cpp | 4 +- 67 files changed, 204 insertions(+), 204 deletions(-) diff --git a/bin/jni/videomanager.i b/bin/jni/videomanager.i index a44710ccd0..538adc8b72 100644 --- a/bin/jni/videomanager.i +++ b/bin/jni/videomanager.i @@ -310,7 +310,7 @@ JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_setNativeWindowGeomet void releaseBuffer(ANativeWindow *window, libjami::FrameBuffer frame) { - std::unique_lock<std::mutex> guard(windows_mutex); + std::unique_lock guard(windows_mutex); try { windows.at(window) = std::move(frame); } catch (...) { diff --git a/src/data_transfer.cpp b/src/data_transfer.cpp index 7cf4d77707..638d542cd1 100644 --- a/src/data_transfer.cpp +++ b/src/data_transfer.cpp @@ -378,7 +378,7 @@ TransferManager::info(const std::string& fileId, int64_t& total, int64_t& progress) const noexcept { - std::unique_lock<std::mutex> lk {pimpl_->mapMutex_}; + std::unique_lock lk {pimpl_->mapMutex_}; if (pimpl_->to_.empty()) return false; @@ -417,7 +417,7 @@ TransferManager::waitForTransfer(const std::string& fileId, const std::string& path, std::size_t total) { - std::unique_lock<std::mutex> lk(pimpl_->mapMutex_); + std::unique_lock lk(pimpl_->mapMutex_); auto itW = pimpl_->waitingIds_.find(fileId); if (itW != pimpl_->waitingIds_.end()) return; diff --git a/src/jamidht/contact_list.cpp b/src/jamidht/contact_list.cpp index 050a0014f1..2c37b1b850 100644 --- a/src/jamidht/contact_list.cpp +++ b/src/jamidht/contact_list.cpp @@ -119,7 +119,7 @@ ContactList::updateConversation(const dht::InfoHash& h, const std::string& conve bool ContactList::removeContact(const dht::InfoHash& h, bool ban) { - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); JAMI_WARN("[Contacts] removeContact: %s", h.to_c_str()); auto c = contacts_.find(h); if (c == contacts_.end()) @@ -298,7 +298,7 @@ ContactList::onTrustRequest(const dht::InfoHash& peer_account, { bool accept = false; // Check existing contact - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); auto contact = contacts_.find(peer_account); bool active = false; if (contact != contacts_.end()) { @@ -391,7 +391,7 @@ bool ContactList::acceptTrustRequest(const dht::InfoHash& from) { // The contact sent us a TR so we are in its contact list - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); auto i = trustRequests_.find(from); if (i == trustRequests_.end()) return false; diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp index ceb0bb4597..86f5d3ae63 100644 --- a/src/jamidht/conversation.cpp +++ b/src/jamidht/conversation.cpp @@ -706,8 +706,8 @@ Conversation::Impl::commitsEndedCalls() auto shared = account_.lock(); // Handle current calls std::vector<std::string> commits {}; - std::unique_lock<std::mutex> lk(writeMtx_); - std::unique_lock<std::mutex> lkA(activeCallsMtx_); + std::unique_lock lk(writeMtx_); + std::unique_lock lkA(activeCallsMtx_); for (const auto& hostedCall : hostedCalls_) { // In this case, this means that we left // the conference while still hosting it, so activeCalls @@ -1044,7 +1044,7 @@ Conversation::Impl::addToHistory(const std::vector<std::map<std::string, std::st return {}; auto username = acc->getUsername(); if (messageReceived && (!optHistory && isLoadingHistory_)) { - std::unique_lock<std::mutex> lk(historyMtx_); + std::unique_lock lk(historyMtx_); historyCv_.wait(lk, [&] { return !isLoadingHistory_; }); } std::vector<std::shared_ptr<libjami::SwarmMessage>> messages; @@ -1198,7 +1198,7 @@ Conversation::addMember(const std::string& contactUri, const OnDoneCb& cb) dht::ThreadPool::io().run([w = weak(), contactUri = std::move(contactUri), cb = std::move(cb)] { if (auto sthis = w.lock()) { // Add member files and commit - std::unique_lock<std::mutex> lk(sthis->pimpl_->writeMtx_); + std::unique_lock lk(sthis->pimpl_->writeMtx_); auto commit = sthis->pimpl_->repository_->addMember(contactUri); sthis->pimpl_->announce(commit, true); lk.unlock(); @@ -1277,7 +1277,7 @@ Conversation::Impl::voteUnban(const std::string& contactUri, } // Vote for removal - std::unique_lock<std::mutex> lk(writeMtx_); + std::unique_lock lk(writeMtx_); auto voteCommit = repository_->voteUnban(contactUri, type); if (voteCommit.empty()) { JAMI_WARN("Unbanning %s failed", contactUri.c_str()); @@ -1342,7 +1342,7 @@ Conversation::removeMember(const std::string& contactUri, bool isDevice, const O } // Vote for removal - std::unique_lock<std::mutex> lk(sthis->pimpl_->writeMtx_); + std::unique_lock lk(sthis->pimpl_->writeMtx_); auto voteCommit = sthis->pimpl_->repository_->voteKick(contactUri, type); if (voteCommit.empty()) { JAMI_WARN("Kicking %s failed", contactUri.c_str()); @@ -1513,7 +1513,7 @@ Conversation::sendMessage(Json::Value&& value, auto acc = sthis->pimpl_->account_.lock(); if (!acc) return; - std::unique_lock<std::mutex> lk(sthis->pimpl_->writeMtx_); + std::unique_lock lk(sthis->pimpl_->writeMtx_); auto commit = sthis->pimpl_->repository_->commitMessage( Json::writeString(jsonBuilder, value)); lk.unlock(); @@ -1533,7 +1533,7 @@ Conversation::sendMessages(std::vector<Json::Value>&& messages, OnMultiDoneCb&& if (auto sthis = w.lock()) { std::vector<std::string> commits; commits.reserve(messages.size()); - std::unique_lock<std::mutex> lk(sthis->pimpl_->writeMtx_); + std::unique_lock lk(sthis->pimpl_->writeMtx_); for (const auto& message : messages) { auto commit = sthis->pimpl_->repository_->commitMessage( Json::writeString(jsonBuilder, message)); @@ -1726,7 +1726,7 @@ Conversation::Impl::pull() } auto oldHead = repo->getHead(); std::string newHead = oldHead; - std::unique_lock<std::mutex> lk(writeMtx_); + std::unique_lock lk(writeMtx_); auto commits = mergeHistory(deviceId); if (!commits.empty()) { newHead = commits.rbegin()->at("id"); @@ -1863,7 +1863,7 @@ Conversation::updateInfos(const std::map<std::string, std::string>& map, const O dht::ThreadPool::io().run([w = weak(), map = std::move(map), cb = std::move(cb)] { if (auto sthis = w.lock()) { auto& repo = sthis->pimpl_->repository_; - std::unique_lock<std::mutex> lk(sthis->pimpl_->writeMtx_); + std::unique_lock lk(sthis->pimpl_->writeMtx_); auto commit = repo->updateInfos(map); sthis->pimpl_->announce(commit, true); lk.unlock(); @@ -2138,7 +2138,7 @@ void Conversation::updateMessageStatus(const std::map<std::string, std::map<std::string, std::string>>& messageStatus) { auto acc = pimpl_->account_.lock(); - std::unique_lock<std::mutex> lk(pimpl_->messageStatusMtx_); + std::unique_lock lk(pimpl_->messageStatusMtx_); std::vector<std::tuple<libjami::Account::MessageStates, std::string, std::string, std::string>> stVec; for (const auto& [uri, status] : messageStatus) { auto& oldMs = pimpl_->messagesStatus_[uri]; @@ -2163,7 +2163,7 @@ Conversation::updateMessageStatus(const std::map<std::string, std::map<std::stri void Conversation::onMessageStatusChanged(const std::function<void(const std::map<std::string, std::map<std::string, std::string>>&)>& cb) { - std::unique_lock<std::mutex> lk(pimpl_->messageStatusMtx_); + std::unique_lock lk(pimpl_->messageStatusMtx_); pimpl_->messageStatusCb_ = cb; } diff --git a/src/jamidht/conversation_module.cpp b/src/jamidht/conversation_module.cpp index b70cc1ac2f..12b556ec02 100644 --- a/src/jamidht/conversation_module.cpp +++ b/src/jamidht/conversation_module.cpp @@ -420,7 +420,7 @@ ConversationModule::Impl::cloneConversation(const std::string& deviceId, JAMI_DEBUG("[Account {}] Clone conversation on device {}", accountId_, deviceId); auto conv = startConversation(convId); - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); cloneConversation(deviceId, peerUri, conv); } @@ -529,7 +529,7 @@ ConversationModule::Impl::fetchNewCommits(const std::string& peer, 0); return; } - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (conv->conversation) { // Check if we already have the commit @@ -667,7 +667,7 @@ ConversationModule::Impl::handlePendingConversation(const std::string& conversat auto conv = getConversation(conversationId); if (!conv) return; - std::unique_lock<std::mutex> lk(conv->mtx, std::defer_lock); + std::unique_lock lk(conv->mtx, std::defer_lock); auto erasePending = [&] { std::string toRm; if (conv->pending && !conv->pending->removeId.empty()) @@ -858,7 +858,7 @@ ConversationModule::Impl::removeRepository(const std::string& conversationId, bo auto conv = getConversation(conversationId); if (!conv) return; - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); removeRepositoryImpl(*conv, sync, force); } @@ -1397,7 +1397,7 @@ ConversationModule::onBootstrapStatus( const std::function<void(std::string, Conversation::BootstrapStatus)>& cb) { pimpl_->bootstrapCbTest_ = cb; - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); for (auto& [_, c] : pimpl_->conversations_) if (c && c->conversation) c->conversation->onBootstrapStatus(pimpl_->bootstrapCbTest_); @@ -1416,8 +1416,8 @@ ConversationModule::loadConversations() auto contacts = acc->getContacts( true); // Avoid to lock configurationMtx while conv Mtx is locked - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); - std::unique_lock<std::mutex> ilk(pimpl_->convInfosMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); + std::unique_lock ilk(pimpl_->convInfosMtx_); pimpl_->convInfos_ = convInfos(pimpl_->accountId_); pimpl_->conversations_.clear(); @@ -1546,7 +1546,7 @@ ConversationModule::loadConversations() }); } - std::unique_lock<std::mutex> lkCv {ctx->cvMtx}; + std::unique_lock lkCv {ctx->cvMtx}; ctx->cv.wait(lkCv, [&] { return ctx->convNb.load() == 0; }); // Prune any invalid conversations without members and @@ -1613,7 +1613,7 @@ ConversationModule::loadSingleConversation(const std::string& convId) return; JAMI_LOG("[Account {}] Start loading conversation {}", pimpl_->accountId_, convId); - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); pimpl_->conversations_.clear(); try { @@ -1641,7 +1641,7 @@ ConversationModule::bootstrap(const std::string& convId) void ConversationModule::monitor() { - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); for (auto& [_, conv] : pimpl_->conversations_) { if (conv && conv->conversation) { conv->conversation->monitor(); @@ -1659,7 +1659,7 @@ ConversationModule::clearPendingFetch() // syncing the conversation. It may have been killed in some un-expected way avoiding to // call the callbacks. This should never happen, but if it's the case, this will allow // new messages to be synced correctly. - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); for (auto& [_, conv] : pimpl_->conversations_) { if (conv && conv->pending) { JAMI_ERR("This is a bug, seems to still fetch to some device on initializing"); @@ -1723,7 +1723,7 @@ ConversationModule::onTrustRequest(const std::string& uri, "clone the old one"); return; } - std::unique_lock<std::mutex> lk(pimpl_->conversationsRequestsMtx_); + std::unique_lock lk(pimpl_->conversationsRequestsMtx_); ConversationRequest req; req.from = uri; req.conversationId = conversationId; @@ -1759,7 +1759,7 @@ ConversationModule::onConversationRequest(const std::string& from, const Json::V if (acc && isOneToOne) { oldConv = getOneToOneConversation(from); } - std::unique_lock<std::mutex> lk(pimpl_->conversationsRequestsMtx_); + std::unique_lock lk(pimpl_->conversationsRequestsMtx_); JAMI_DEBUG("[Account {}] Receive a new conversation request for conversation {} from {}", pimpl_->accountId_, req.conversationId, @@ -1834,12 +1834,12 @@ ConversationModule::acceptConversationRequest(const std::string& conversationId, const std::string& deviceId) { // For all conversation members, try to open a git channel with this conversation ID - std::unique_lock<std::mutex> lkCr(pimpl_->conversationsRequestsMtx_); + std::unique_lock lkCr(pimpl_->conversationsRequestsMtx_); auto request = pimpl_->getRequest(conversationId); if (request == std::nullopt) { lkCr.unlock(); if (auto conv = pimpl_->getConversation(conversationId)) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (!conv->conversation) { lk.unlock(); pimpl_->cloneConversationFrom(conv, deviceId); @@ -1910,7 +1910,7 @@ ConversationModule::startConversation(ConversationMode mode, const std::string& } auto convId = conversation->id(); auto conv = pimpl_->startConversation(convId); - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); conv->info.created = std::time(nullptr); conv->info.members.emplace(pimpl_->username_); if (!otherMember.empty()) @@ -2011,7 +2011,7 @@ ConversationModule::onMessageDisplayed(const std::string& peer, const std::string& interactionId) { if (auto conv = pimpl_->getConversation(conversationId)) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (auto conversation = conv->conversation) { lk.unlock(); return conversation->setMessageDisplayed(peer, interactionId); @@ -2245,7 +2245,7 @@ ConversationModule::onSyncData(const SyncMsg& msg, } auto conv = pimpl_->startConversation(convInfo); - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); // Skip outdated info if (std::max(convInfo.created, convInfo.removed) < std::max(conv->info.created, conv->info.removed)) @@ -2307,7 +2307,7 @@ ConversationModule::onSyncData(const SyncMsg& msg, JAMI_WARNING("Detected request from ourself, ignore {}.", convId); continue; } - std::unique_lock<std::mutex> lk(pimpl_->conversationsRequestsMtx_); + std::unique_lock lk(pimpl_->conversationsRequestsMtx_); if (pimpl_->isConversation(convId)) { // Already handled request pimpl_->rmConversationRequest(convId); @@ -2343,7 +2343,7 @@ ConversationModule::onSyncData(const SyncMsg& msg, // Updates preferences for conversations for (const auto& [convId, p] : msg.p) { if (auto conv = pimpl_->getConversation(convId)) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (conv->conversation) { auto conversation = conv->conversation; lk.unlock(); @@ -2357,7 +2357,7 @@ ConversationModule::onSyncData(const SyncMsg& msg, // Updates displayed for conversations for (const auto& [convId, ms] : msg.ms) { if (auto conv = pimpl_->getConversation(convId)) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (conv->conversation) { auto conversation = conv->conversation; lk.unlock(); @@ -2424,7 +2424,7 @@ ConversationModule::addConversationMember(const std::string& conversationId, JAMI_ERROR("Conversation {:s} doesn't exist", conversationId); return; } - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (conv->conversation->isMember(contactUri, true)) { JAMI_DEBUG("{:s} is already a member of {:s}, resend invite", contactUri, conversationId); @@ -2440,7 +2440,7 @@ ConversationModule::addConversationMember(const std::string& conversationId, contactUri, [this, conv, conversationId, sendRequest, contactUri](bool ok, const std::string& commitId) { if (ok) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); pimpl_->sendMessageNotification(*conv->conversation, true, commitId); // For the other members @@ -2496,7 +2496,7 @@ ConversationModule::search(uint32_t req, const std::string& convId, const Filter { if (convId.empty()) { auto finishedFlag = std::make_shared<std::atomic_int>(pimpl_->conversations_.size()); - std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_); + std::unique_lock lk(pimpl_->conversationsMtx_); for (const auto& [cid, conv] : pimpl_->conversations_) { std::lock_guard lk(conv->mtx); if (!conv->conversation) { @@ -2563,7 +2563,7 @@ ConversationModule::setConversationPreferences(const std::string& conversationId const std::map<std::string, std::string>& prefs) { if (auto conv = pimpl_->getConversation(conversationId)) { - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (not conv->conversation) { JAMI_ERROR("Conversation {:s} doesn't exist", conversationId); return; @@ -2814,7 +2814,7 @@ ConversationModule::call(const std::string& url, auto conv = pimpl_->getConversation(conversationId); if (!conv) return; - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (!conv->conversation) { JAMI_ERROR("Conversation {:s} not found", conversationId); return; @@ -2916,7 +2916,7 @@ ConversationModule::hostConference(const std::string& conversationId, auto conv = pimpl_->getConversation(conversationId); if (!conv) return; - std::unique_lock<std::mutex> lk(conv->mtx); + std::unique_lock lk(conv->mtx); if (!conv->conversation) { JAMI_ERROR("Conversation {} not found", conversationId); return; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index af59cee5b8..03ee0a4e3e 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -437,7 +437,7 @@ JamiAccount::newSwarmOutgoingCallHelper(const std::shared_ptr<SIPCall>& call, co uri.authority(), call, [this, uri, call](const std::string& accountUri, const DeviceId& deviceId) { - std::unique_lock<std::mutex> lkSipConn(sipConnsMtx_); + std::unique_lock lkSipConn(sipConnsMtx_); for (auto& [key, value] : sipConns_) { if (key.first != accountUri || key.second != deviceId) continue; @@ -604,7 +604,7 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std:: // Call connected devices std::set<DeviceId> devices; - std::unique_lock<std::mutex> lkSipConn(sipConnsMtx_); + std::unique_lock lkSipConn(sipConnsMtx_); // NOTE: dummyCall is a call used to avoid to mark the call as failed if the // cached connection is failing with ICE (close event still not detected). auto dummyCall = createSubCall(call); @@ -1945,7 +1945,7 @@ JamiAccount::doRegister_() if (accountManager_->getInfo()->deviceId == deviceId) return; - std::unique_lock<std::mutex> lk(connManagerMtx_); + std::unique_lock lk(connManagerMtx_); initConnectionManager(); channelHandlers_[Uri::Scheme::SYNC] ->connect(crt->getLongId(), @@ -1988,7 +1988,7 @@ JamiAccount::doRegister_() accountManager_->setDht(dht_); - std::unique_lock<std::mutex> lkCM(connManagerMtx_); + std::unique_lock lkCM(connManagerMtx_); initConnectionManager(); connectionManager_->onDhtConnected(*accountManager_->getInfo()->devicePk); connectionManager_->onICERequest([this](const DeviceId& deviceId) { @@ -2232,7 +2232,7 @@ JamiAccount::convModule(bool noCreation) cb({}); return; } - std::unique_lock<std::mutex> lkCM(shared->connManagerMtx_); + std::unique_lock lkCM(shared->connManagerMtx_); if (!shared->connectionManager_) { lkCM.unlock(); cb({}); @@ -2412,7 +2412,7 @@ JamiAccount::doUnregister(std::function<void(bool)> released_cb) } { - std::unique_lock<std::mutex> lock(mtx); + std::unique_lock lock(mtx); cv.wait(lock, [&] { return shutdown_complete; }); } dht_->join(); @@ -3039,7 +3039,7 @@ JamiAccount::sendMessage(const std::string& to, } std::shared_ptr<std::set<DeviceId>> devices = std::make_shared<std::set<DeviceId>>(); - std::unique_lock<std::mutex> lk(sipConnsMtx_); + std::unique_lock lk(sipConnsMtx_); for (auto it = sipConns_.begin(); it != sipConns_.end();) { auto& [key, value] = *it; @@ -3218,7 +3218,7 @@ JamiAccount::sendMessage(const std::string& to, << token << "] Put encrypted " << (ok ? "ok" : "failed"); if (not ok && connectionManager_ /* Check if not joining */) { - std::unique_lock<std::mutex> l(confirm->lock); + std::unique_lock l(confirm->lock); auto lt = confirm->listenTokens.find(h); if (lt != confirm->listenTokens.end()) { std::shared_future<size_t> tok = std::move( @@ -3256,7 +3256,7 @@ JamiAccount::sendMessage(const std::string& to, // Timeout cleanup Manager::instance().scheduleTaskIn( [w = weak(), confirm, to, token]() { - std::unique_lock<std::mutex> l(confirm->lock); + std::unique_lock l(confirm->lock); if (not confirm->replied) { if (auto this_ = w.lock()) { JAMI_DBG() << "[Account " << this_->getAccountID() << "] [message " << token @@ -3284,7 +3284,7 @@ void JamiAccount::onSIPMessageSent(const std::shared_ptr<TextMessageCtx>& ctx, int code) { if (code == PJSIP_SC_OK) { - std::unique_lock<std::mutex> l(ctx->confirmation->lock); + std::unique_lock l(ctx->confirmation->lock); ctx->confirmation->replied = true; l.unlock(); if (!ctx->onlyConnected) @@ -3899,7 +3899,7 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<dhtnet::ChannelSocket>&& socket, const std::string& peerId, const DeviceId& deviceId) { - std::unique_lock<std::mutex> lk(sipConnsMtx_); + std::unique_lock lk(sipConnsMtx_); // Verify that the connection is not already cached SipConnectionKey key(peerId, deviceId); auto& connections = sipConns_[key]; @@ -3987,7 +3987,7 @@ JamiAccount::shutdownSIPConnection(const std::shared_ptr<dhtnet::ChannelSocket>& const std::string& peerId, const DeviceId& deviceId) { - std::unique_lock<std::mutex> lk(sipConnsMtx_); + std::unique_lock lk(sipConnsMtx_); SipConnectionKey key(peerId, deviceId); auto it = sipConns_.find(key); if (it != sipConns_.end()) { diff --git a/src/jamidht/swarm/swarm_manager.cpp b/src/jamidht/swarm/swarm_manager.cpp index 898c21987a..2a6bc0d89b 100644 --- a/src/jamidht/swarm/swarm_manager.cpp +++ b/src/jamidht/swarm/swarm_manager.cpp @@ -113,7 +113,7 @@ SwarmManager::addChannel(const std::shared_ptr<dhtnet::ChannelSocketInterface>& void SwarmManager::removeNode(const NodeId& nodeId) { - std::unique_lock<std::mutex> lk(mutex); + std::unique_lock lk(mutex); if (isConnectedWith(nodeId)) { removeNodeInternal(nodeId); lk.unlock(); @@ -164,7 +164,7 @@ void SwarmManager::maintainBuckets(const std::set<NodeId>& toConnect) { std::set<NodeId> nodes = toConnect; - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); auto& buckets = routing_table.getBuckets(); for (auto it = buckets.begin(); it != buckets.end(); ++it) { auto& bucket = *it; @@ -345,7 +345,7 @@ SwarmManager::tryConnect(const NodeId& nodeId) shared->addChannel(socket); return true; } - std::unique_lock<std::mutex> lk(shared->mutex); + std::unique_lock lk(shared->mutex); auto bucket = shared->routing_table.findBucket(nodeId); bucket->removeConnectingNode(nodeId); bucket->addKnownNode(nodeId); diff --git a/src/logger.cpp b/src/logger.cpp index ddabaa52a4..063308346b 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -482,7 +482,7 @@ public: std::vector<Logger::Msg> pendingQ_; while (isEnable()) { { - std::unique_lock<std::mutex> lk(mtx_); + std::unique_lock lk(mtx_); cv_.wait(lk, [&] { return not isEnable() or not currentQ_.empty(); }); if (not isEnable()) break; diff --git a/src/manager.cpp b/src/manager.cpp index b4abeceb1e..7f44fdb10a 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -2912,7 +2912,7 @@ Manager::loadAccountMap(const YAML::Node& node) std::condition_variable cv; std::mutex lock; size_t remaining {0}; - std::unique_lock<std::mutex> l(lock); + std::unique_lock l(lock); for (const auto& dir : dirs) { if (accountFactory.hasAccount<JamiAccount>(dir)) { continue; diff --git a/src/media/audio/alsa/alsalayer.cpp b/src/media/audio/alsa/alsalayer.cpp index e7ca22d12a..c5f753ac21 100644 --- a/src/media/audio/alsa/alsalayer.cpp +++ b/src/media/audio/alsa/alsalayer.cpp @@ -126,7 +126,7 @@ AlsaLayer::openDevice(snd_pcm_t** pcm, void AlsaLayer::startStream(AudioDeviceType type) { - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); status_ = Status::Starting; stopThread(); @@ -172,7 +172,7 @@ AlsaLayer::startStream(AudioDeviceType type) void AlsaLayer::stopStream(AudioDeviceType stream) { - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); stopThread(); if (stream == AudioDeviceType::CAPTURE && is_capture_open_) { diff --git a/src/media/audio/audio_input.cpp b/src/media/audio/audio_input.cpp index 35ad39f87f..9784afba62 100644 --- a/src/media/audio/audio_input.cpp +++ b/src/media/audio/audio_input.cpp @@ -278,7 +278,7 @@ std::shared_future<DeviceParams> AudioInput::switchInput(const std::string& resource) { // Always switch inputs, even if it's the same resource, so audio will be in sync with video - std::unique_lock<std::mutex> lk(resourceMutex_); + std::unique_lock lk(resourceMutex_); JAMI_DEBUG("Switching audio source from {} to {}", resource_, resource); diff --git a/src/media/audio/audiolayer.h b/src/media/audio/audiolayer.h index e01bb6579e..0a89bf0002 100644 --- a/src/media/audio/audiolayer.h +++ b/src/media/audio/audiolayer.h @@ -104,7 +104,7 @@ public: template<class Rep, class Period> bool waitForStart(const std::chrono::duration<Rep, Period>& rel_time) const { - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); startedCv_.wait_for(lk, rel_time, [this] { return isStarted(); }); return isStarted(); } diff --git a/src/media/audio/jack/jacklayer.cpp b/src/media/audio/jack/jacklayer.cpp index d92baee39c..f0ede117bc 100644 --- a/src/media/audio/jack/jacklayer.cpp +++ b/src/media/audio/jack/jacklayer.cpp @@ -153,7 +153,7 @@ JackLayer::ringbuffer_worker() flushUrgent(); while (true) { - std::unique_lock<std::mutex> lock(ringbuffer_thread_mutex_); + std::unique_lock lock(ringbuffer_thread_mutex_); // may have changed, we don't want to wait for a notification we won't get if (status_ != Status::Started) diff --git a/src/media/audio/opensl/audio_player.cpp b/src/media/audio/opensl/audio_player.cpp index be65c26387..ca1f27d8b9 100644 --- a/src/media/audio/opensl/audio_player.cpp +++ b/src/media/audio/opensl/audio_player.cpp @@ -45,7 +45,7 @@ bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* ctx) void AudioPlayer::processSLCallback(SLAndroidSimpleBufferQueueItf bq) { - std::unique_lock<std::mutex> lk(m_, std::defer_lock); + std::unique_lock lk(m_, std::defer_lock); if (!lk.try_lock()) return; @@ -198,7 +198,7 @@ bool AudioPlayer::start() { JAMI_DBG("OpenSL playback start"); - std::unique_lock<std::mutex> lk(m_); + std::unique_lock lk(m_); SLuint32 state; SLresult result = (*playItf_)->GetPlayState(playItf_, &state); if (result != SL_RESULT_SUCCESS) diff --git a/src/media/audio/opensl/opensllayer.cpp b/src/media/audio/opensl/opensllayer.cpp index 59783709dd..e234bbfdc9 100644 --- a/src/media/audio/opensl/opensllayer.cpp +++ b/src/media/audio/opensl/opensllayer.cpp @@ -336,7 +336,7 @@ OpenSLLayer::startAudioCapture() if (recThread.joinable()) return; recThread = std::thread([&]() { - std::unique_lock<std::mutex> lck(recMtx); + std::unique_lock lck(recMtx); if (recorder_) recorder_->start(); recordChanged(true); diff --git a/src/media/audio/portaudio/portaudiolayer.cpp b/src/media/audio/portaudio/portaudiolayer.cpp index 7572986d58..ca82a03d27 100644 --- a/src/media/audio/portaudio/portaudiolayer.cpp +++ b/src/media/audio/portaudio/portaudiolayer.cpp @@ -173,7 +173,7 @@ PortAudioLayer::startStream(AudioDeviceType stream) } auto startPlayback = [this](bool fullDuplexMode = false) -> bool { - std::unique_lock<std::mutex> lock(mutex_); + std::unique_lock lock(mutex_); if (status_.load() != Status::Idle) return false; bool ret {false}; diff --git a/src/media/audio/pulseaudio/audiostream.cpp b/src/media/audio/pulseaudio/audiostream.cpp index f3a664a97b..dae54014f4 100644 --- a/src/media/audio/pulseaudio/audiostream.cpp +++ b/src/media/audio/pulseaudio/audiostream.cpp @@ -183,7 +183,7 @@ AudioStream::stop() } audiostream_ = nullptr; - std::unique_lock<std::mutex> lock(mutex_); + std::unique_lock lock(mutex_); for (auto op : ongoing_ops) pa_operation_cancel(op); // wait for all operations to end diff --git a/src/media/audio/pulseaudio/pulselayer.cpp b/src/media/audio/pulseaudio/pulselayer.cpp index 41ceb49584..5dcf0f1345 100644 --- a/src/media/audio/pulseaudio/pulselayer.cpp +++ b/src/media/audio/pulseaudio/pulselayer.cpp @@ -175,7 +175,7 @@ PulseLayer::contextStateChanged(pa_context* c) void PulseLayer::updateSinkList() { - std::unique_lock<std::mutex> lk(readyMtx_); + std::unique_lock lk(readyMtx_); if (not enumeratingSinks_) { JAMI_DBG("Updating PulseAudio sink list"); enumeratingSinks_ = true; @@ -192,7 +192,7 @@ PulseLayer::updateSinkList() void PulseLayer::updateSourceList() { - std::unique_lock<std::mutex> lk(readyMtx_); + std::unique_lock lk(readyMtx_); if (not enumeratingSources_) { JAMI_DBG("Updating PulseAudio source list"); enumeratingSources_ = true; @@ -209,7 +209,7 @@ PulseLayer::updateSourceList() void PulseLayer::updateServerInfo() { - std::unique_lock<std::mutex> lk(readyMtx_); + std::unique_lock lk(readyMtx_); if (not gettingServerInfo_) { JAMI_DBG("Updating PulseAudio server infos"); gettingServerInfo_ = true; @@ -628,7 +628,7 @@ PulseLayer::contextChanged(pa_context* c UNUSED, void PulseLayer::waitForDevices() { - std::unique_lock<std::mutex> lk(readyMtx_); + std::unique_lock lk(readyMtx_); readyCv_.wait(lk, [this] { return !(enumeratingSinks_ or enumeratingSources_ or gettingServerInfo_); }); @@ -637,7 +637,7 @@ PulseLayer::waitForDevices() void PulseLayer::waitForDeviceList() { - std::unique_lock<std::mutex> lock(readyMtx_); + std::unique_lock lock(readyMtx_); if (waitingDeviceList_.exchange(true)) return; if (streamStarter_.joinable()) diff --git a/src/media/audio/ringbuffer.cpp b/src/media/audio/ringbuffer.cpp index da8fc5b814..6ed0d0d9e9 100644 --- a/src/media/audio/ringbuffer.cpp +++ b/src/media/audio/ringbuffer.cpp @@ -243,7 +243,7 @@ RingBuffer::get(const std::string& ringbufferId) size_t RingBuffer::waitForDataAvailable(const std::string& ringbufferId, const time_point& deadline) const { - std::unique_lock<std::mutex> l(lock_); + std::unique_lock l(lock_); if (buffer_.empty()) return 0; diff --git a/src/media/media_decoder.cpp b/src/media/media_decoder.cpp index 589001e0fe..731f161709 100644 --- a/src/media/media_decoder.cpp +++ b/src/media/media_decoder.cpp @@ -275,7 +275,7 @@ MediaDemuxer::pushFrameFrom( bool isAudio, std::mutex& mutex) { - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); if (buffer.empty()) { if (currentState_ == MediaDemuxer::CurrentState::Finished) { fileFinishedCb_(isAudio); diff --git a/src/media/media_recorder.cpp b/src/media/media_recorder.cpp index 6694c31ec0..139ae53d46 100644 --- a/src/media/media_recorder.cpp +++ b/src/media/media_recorder.cpp @@ -224,7 +224,7 @@ MediaRecorder::startRecording() std::shared_ptr<MediaFrame> frame; // get frame from queue { - std::unique_lock<std::mutex> lk(rec->mutexFrameBuff_); + std::unique_lock lk(rec->mutexFrameBuff_); rec->cv_.wait(lk, [rec] { return rec->interrupted_ or not rec->frameBuff_.empty(); }); diff --git a/src/media/socket_pair.cpp b/src/media/socket_pair.cpp index 5d2a452f0d..0589affd50 100644 --- a/src/media/socket_pair.cpp +++ b/src/media/socket_pair.cpp @@ -220,7 +220,7 @@ SocketPair::~SocketPair() bool SocketPair::waitForRTCP(std::chrono::seconds interval) { - std::unique_lock<std::mutex> lock(rtcpInfo_mutex_); + std::unique_lock lock(rtcpInfo_mutex_); return cvRtcpPacketReadyToRead_.wait_for(lock, interval, [this] { return interrupted_ or not listRtcpRRHeader_.empty() or not listRtcpREMBHeader_.empty(); }); @@ -422,7 +422,7 @@ SocketPair::waitForData() // work with IceSocket { - std::unique_lock<std::mutex> lk(dataBuffMutex_); + std::unique_lock lk(dataBuffMutex_); cv_.wait(lk, [this] { return interrupted_ or not rtpDataBuff_.empty() or not rtcpDataBuff_.empty() or not readBlockingMode_; @@ -453,7 +453,7 @@ SocketPair::readRtpData(void* buf, int buf_size) } // handle ICE - std::unique_lock<std::mutex> lk(dataBuffMutex_); + std::unique_lock lk(dataBuffMutex_); if (not rtpDataBuff_.empty()) { auto pkt = std::move(rtpDataBuff_.front()); rtpDataBuff_.pop_front(); @@ -483,7 +483,7 @@ SocketPair::readRtcpData(void* buf, int buf_size) } // handle ICE - std::unique_lock<std::mutex> lk(dataBuffMutex_); + std::unique_lock lk(dataBuffMutex_); if (not rtcpDataBuff_.empty()) { auto pkt = std::move(rtcpDataBuff_.front()); rtcpDataBuff_.pop_front(); diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp index 2b44f16986..c94237b056 100644 --- a/src/media/video/sinkclient.cpp +++ b/src/media/video/sinkclient.cpp @@ -453,7 +453,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/, } #endif - std::unique_lock<std::mutex> lock(mtx_); + std::unique_lock lock(mtx_); bool hasObservers = getObserversCount() != 0; bool hasDirectListener = target_.push and not target_.pull; bool hasTransformedListener = target_.push and target_.pull; diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 63e339d304..10c400cb17 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -197,7 +197,7 @@ VideoMixer::detachVideo(Observable<std::shared_ptr<MediaFrame>>* frame) if (!frame) return; bool detach = false; - std::unique_lock<std::mutex> lk(videoToStreamInfoMtx_); + std::unique_lock lk(videoToStreamInfoMtx_); auto it = videoToStreamInfo_.find(frame); if (it != videoToStreamInfo_.end()) { JAMI_DBG("Detaching video of call %s", it->second.callId.c_str()); diff --git a/src/media/video/video_mixer.h b/src/media/video/video_mixer.h index 04e66d4f72..7d044d7f39 100644 --- a/src/media/video/video_mixer.h +++ b/src/media/video/video_mixer.h @@ -123,7 +123,7 @@ public: void addAudioOnlySource(const std::string& callId, const std::string& streamId) { - std::unique_lock<std::mutex> lk(audioOnlySourcesMtx_); + std::unique_lock lk(audioOnlySourcesMtx_); audioOnlySources_.insert({callId, streamId}); lk.unlock(); updateLayout(); @@ -131,7 +131,7 @@ public: void removeAudioOnlySource(const std::string& callId, const std::string& streamId) { - std::unique_lock<std::mutex> lk(audioOnlySourcesMtx_); + std::unique_lock lk(audioOnlySourcesMtx_); if (audioOnlySources_.erase({callId, streamId})) { lk.unlock(); updateLayout(); diff --git a/src/scheduled_executor.cpp b/src/scheduled_executor.cpp index f54caa86ae..de3f23234b 100644 --- a/src/scheduled_executor.cpp +++ b/src/scheduled_executor.cpp @@ -126,7 +126,7 @@ ScheduledExecutor::loop() { std::vector<Job> jobs; { - std::unique_lock<std::mutex> lock(jobLock_); + std::unique_lock lock(jobLock_); while (*running_ and (jobs_.empty() or jobs_.begin()->first > clock::now())) { if (jobs_.empty()) cv_.wait(lock); diff --git a/src/sip/siptransport.cpp b/src/sip/siptransport.cpp index bd0bf48c2e..da9d52cac2 100644 --- a/src/sip/siptransport.cpp +++ b/src/sip/siptransport.cpp @@ -270,7 +270,7 @@ SipTransportBroker::addTransport(pjsip_transport* t) void SipTransportBroker::shutdown() { - std::unique_lock<std::mutex> lock(transportMapMutex_); + std::unique_lock lock(transportMapMutex_); isDestroying_ = true; for (auto& t : transports_) { if (auto transport = t.second.lock()) { diff --git a/src/threadloop.h b/src/threadloop.h index a8100827d2..36e4616c86 100644 --- a/src/threadloop.h +++ b/src/threadloop.h @@ -97,7 +97,7 @@ public: if (std::this_thread::get_id() != get_id()) throw std::runtime_error("can not call wait_for outside thread context"); - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); cv_.wait_for(lk, rel_time, [this]() { return isStopping(); }); } @@ -107,7 +107,7 @@ public: if (std::this_thread::get_id() != get_id()) throw std::runtime_error("can not call wait_for outside thread context"); - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); return cv_.wait_for(lk, rel_time, [this, pred] { return isStopping() || pred(); }); } @@ -117,7 +117,7 @@ public: if (std::this_thread::get_id() != get_id()) throw std::runtime_error("Can not call wait outside thread context"); - std::unique_lock<std::mutex> lk(mutex_); + std::unique_lock lk(mutex_); cv_.wait(lk, [this, p = std::forward<Pred>(pred)] { return isStopping() || p(); }); } diff --git a/test/agent/src/bindings/signal.cpp b/test/agent/src/bindings/signal.cpp index c808b4c068..e40443e141 100644 --- a/test/agent/src/bindings/signal.cpp +++ b/test/agent/src/bindings/signal.cpp @@ -68,7 +68,7 @@ public: void doExecuteInGuile(Args... args) { - std::unique_lock<std::mutex> lck(mutex_); + std::unique_lock lck(mutex_); std::vector<SCM> old; std::vector<SCM> to_keep; @@ -141,7 +141,7 @@ on_signal_binding(SCM signal_sym, SCM handler_proc) callbacks = static_cast<std::vector<SCM>*>(scm_to_pointer(scm_car(handler_pair))); mutex = static_cast<std::mutex*>(scm_to_pointer(scm_cdr(handler_pair))); - std::unique_lock<std::mutex> lck(*mutex); + std::unique_lock lck(*mutex); scm_gc_protect_object(handler_proc); callbacks->push_back(handler_proc); diff --git a/test/fuzzing/examples/fuzz-channel.cpp b/test/fuzzing/examples/fuzz-channel.cpp index 8bfb277dc4..542eb99b7d 100644 --- a/test/fuzzing/examples/fuzz-channel.cpp +++ b/test/fuzzing/examples/fuzz-channel.cpp @@ -34,7 +34,7 @@ static void channel_spammer(void) { std::thread([&]{ - std::unique_lock<std::mutex> ulock(spammer_lock); + std::unique_lock ulock(spammer_lock); while (true) { } diff --git a/test/fuzzing/examples/fuzz-jami-version.cpp b/test/fuzzing/examples/fuzz-jami-version.cpp index 4022bd9898..0c51583991 100644 --- a/test/fuzzing/examples/fuzz-jami-version.cpp +++ b/test/fuzzing/examples/fuzz-jami-version.cpp @@ -62,7 +62,7 @@ init(void) pk.pack_bin_body(buffer2.data(), buffer2.size()); } - std::unique_lock<std::mutex> lock(worker_lock); + std::unique_lock lock(worker_lock); cv.wait(lock); diff --git a/test/fuzzing/examples/fuzz-random-over-tls.cpp b/test/fuzzing/examples/fuzz-random-over-tls.cpp index 09370e069d..a8e535eeb5 100644 --- a/test/fuzzing/examples/fuzz-random-over-tls.cpp +++ b/test/fuzzing/examples/fuzz-random-over-tls.cpp @@ -38,7 +38,7 @@ init(void) { std::thread([&] { - std::unique_lock<std::mutex> lock(worker_lock); + std::unique_lock lock(worker_lock); cv.wait(lock); diff --git a/test/fuzzing/lib/utils.cpp b/test/fuzzing/lib/utils.cpp index 4e80052808..088c4b237b 100644 --- a/test/fuzzing/lib/utils.cpp +++ b/test/fuzzing/lib/utils.cpp @@ -37,7 +37,7 @@ wait_for_announcement_of(const std::vector<std::string> accountIDs, std::chrono: { std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto cv = std::make_shared<std::condition_variable>(); auto accountsReady = std::make_shared<std::vector<std::atomic_bool>>(accountIDs.size()); @@ -98,7 +98,7 @@ wait_for_removal_of(const std::vector<std::string> accounts, std::chrono::second { std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto cv = std::make_shared<std::condition_variable>(); auto accountsRemoved = std::make_shared<std::atomic_bool>(false); diff --git a/test/fuzzing/scenarios/classic-alice-and-bob.h b/test/fuzzing/scenarios/classic-alice-and-bob.h index a8b20b39b1..ac5603464c 100644 --- a/test/fuzzing/scenarios/classic-alice-and-bob.h +++ b/test/fuzzing/scenarios/classic-alice-and-bob.h @@ -50,7 +50,7 @@ int main(void) std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; confHandlers.insert(libjami::exportable_callback<libjami::CallSignal::IncomingCall>( diff --git a/test/unitTest/account_archive/account_archive.cpp b/test/unitTest/account_archive/account_archive.cpp index 97ad75dc13..216f264cbb 100644 --- a/test/unitTest/account_archive/account_archive.cpp +++ b/test/unitTest/account_archive/account_archive.cpp @@ -70,7 +70,7 @@ public: std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; bool aliceReady = false; @@ -214,7 +214,7 @@ void AccountArchiveTest::testExportDht() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::string pin; @@ -244,7 +244,7 @@ void AccountArchiveTest::testExportDhtWrongPassword() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; int status; diff --git a/test/unitTest/account_archive/migration.cpp b/test/unitTest/account_archive/migration.cpp index 7aaa10e55e..2687d18063 100644 --- a/test/unitTest/account_archive/migration.cpp +++ b/test/unitTest/account_archive/migration.cpp @@ -127,7 +127,7 @@ MigrationTest::testLoadExpiredAccount() // reload account, check migration signals std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; auto aliceMigrated = false; @@ -163,7 +163,7 @@ MigrationTest::testMigrationAfterRevokation() // Generate bob2 std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; // Add second device for Bob @@ -231,7 +231,7 @@ MigrationTest::testExpiredDeviceInSwarm() auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; auto messageBobReceived = 0, messageAliceReceived = 0; diff --git a/test/unitTest/account_factory/testAccount_factory.cpp b/test/unitTest/account_factory/testAccount_factory.cpp index 30b27cec8b..2a9f6bb42f 100644 --- a/test/unitTest/account_factory/testAccount_factory.cpp +++ b/test/unitTest/account_factory/testAccount_factory.cpp @@ -68,7 +68,7 @@ private: size_t initialAccounts; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; }; diff --git a/test/unitTest/call/call.cpp b/test/unitTest/call/call.cpp index 8903b5d412..a01ae111f2 100644 --- a/test/unitTest/call/call.cpp +++ b/test/unitTest/call/call.cpp @@ -122,7 +122,7 @@ CallTest::testCall() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}; @@ -171,7 +171,7 @@ CallTest::testCachedCall() aliceAccount->certStore().pinCertificate(bobAccount->identity().second); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}, successfullyConnected {false}; @@ -228,7 +228,7 @@ CallTest::testStopSearching() Manager::instance().sendRegister(bobId, false); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callStopped {false}; @@ -259,7 +259,7 @@ CallTest::testDeclineMultiDevice() auto bobUri = bobAccount->getUsername(); auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; // Add second device for Bob @@ -327,7 +327,7 @@ CallTest::testTlsInfosPeerCertificate() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic<int> callStopped {0}; @@ -385,7 +385,7 @@ CallTest::testSocketInfos() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic<int> callStopped {0}; @@ -457,7 +457,7 @@ CallTest::testInvalidTurn() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}; @@ -527,7 +527,7 @@ CallTest::testTransfer() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool bobCallReceived {false}; @@ -596,7 +596,7 @@ CallTest::testDhtPublicInCall() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}; diff --git a/test/unitTest/call/conference.cpp b/test/unitTest/call/conference.cpp index 19d7bd2d64..994805bfff 100644 --- a/test/unitTest/call/conference.cpp +++ b/test/unitTest/call/conference.cpp @@ -152,7 +152,7 @@ private: CallData daviCall {}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void registerSignalHandlers(); diff --git a/test/unitTest/call/recorder.cpp b/test/unitTest/call/recorder.cpp index 7c5c4d02e9..ce425e772e 100644 --- a/test/unitTest/call/recorder.cpp +++ b/test/unitTest/call/recorder.cpp @@ -84,7 +84,7 @@ public: CallData bobCall {}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::string videoPath = "file://" + std::filesystem::absolute("media/test_video_file.mp4").string(); diff --git a/test/unitTest/call/sipcall.cpp b/test/unitTest/call/sipcall.cpp index 91189b1f64..a3f0260ffc 100644 --- a/test/unitTest/call/sipcall.cpp +++ b/test/unitTest/call/sipcall.cpp @@ -97,7 +97,7 @@ SIPCallTest::testCall() auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_bool callReceived {false}; diff --git a/test/unitTest/common.cpp b/test/unitTest/common.cpp index ab3aea681c..8e8ea51af3 100644 --- a/test/unitTest/common.cpp +++ b/test/unitTest/common.cpp @@ -42,7 +42,7 @@ wait_for_announcement_of(const std::vector<std::string> accountIDs, { std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::vector<std::atomic_bool> accountsReady(accountIDs.size()); @@ -113,7 +113,7 @@ wait_for_removal_of(const std::vector<std::string> accounts, std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::atomic_bool accountsRemoved {false}; diff --git a/test/unitTest/conversation/call.cpp b/test/unitTest/conversation/call.cpp index 7a49806c3a..6ef0ee4ead 100644 --- a/test/unitTest/conversation/call.cpp +++ b/test/unitTest/conversation/call.cpp @@ -69,7 +69,7 @@ public: std::vector<std::map<std::string, std::string>> pInfos_ {}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; private: diff --git a/test/unitTest/conversation/conversation.cpp b/test/unitTest/conversation/conversation.cpp index 69cf03cf1a..c6a170ccd8 100644 --- a/test/unitTest/conversation/conversation.cpp +++ b/test/unitTest/conversation/conversation.cpp @@ -101,7 +101,7 @@ public: UserData carlaData; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); diff --git a/test/unitTest/conversation/conversationFetchSent.cpp b/test/unitTest/conversation/conversationFetchSent.cpp index e7c6eac6e5..8f83190c10 100644 --- a/test/unitTest/conversation/conversationFetchSent.cpp +++ b/test/unitTest/conversation/conversationFetchSent.cpp @@ -76,7 +76,7 @@ public: UserData carlaData; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); diff --git a/test/unitTest/conversation/conversationMembersEvent.cpp b/test/unitTest/conversation/conversationMembersEvent.cpp index 328a4ce507..e85aaf0aa9 100644 --- a/test/unitTest/conversation/conversationMembersEvent.cpp +++ b/test/unitTest/conversation/conversationMembersEvent.cpp @@ -118,7 +118,7 @@ public: std::string carlaId; UserData carlaData; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); diff --git a/test/unitTest/conversation/conversationRequest.cpp b/test/unitTest/conversation/conversationRequest.cpp index 512e7d380c..69a5af190c 100644 --- a/test/unitTest/conversation/conversationRequest.cpp +++ b/test/unitTest/conversation/conversationRequest.cpp @@ -105,7 +105,7 @@ public: UserData carlaData; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); @@ -719,7 +719,7 @@ ConversationRequestTest::testBanContactRestartAccount() auto bobUri = bobAccount->getUsername(); auto aliceUri = aliceAccount->getUsername(); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool conversationReady = false, requestReceived = false, memberMessageGenerated = false; @@ -1050,7 +1050,7 @@ ConversationRequestTest::testAddConversationNoPresenceThenConnects() carlaAccount->publishPresence(false); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::string convId = ""; diff --git a/test/unitTest/conversation/typers.cpp b/test/unitTest/conversation/typers.cpp index 82ee796db3..7229a381d9 100644 --- a/test/unitTest/conversation/typers.cpp +++ b/test/unitTest/conversation/typers.cpp @@ -67,7 +67,7 @@ public: UserData bobData; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); diff --git a/test/unitTest/fileTransfer/fileTransfer.cpp b/test/unitTest/fileTransfer/fileTransfer.cpp index 852b527111..ceeda2a71f 100644 --- a/test/unitTest/fileTransfer/fileTransfer.cpp +++ b/test/unitTest/fileTransfer/fileTransfer.cpp @@ -85,7 +85,7 @@ public: std::filesystem::path recv2Path {std::filesystem::current_path() / "RECV2"}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); diff --git a/test/unitTest/ice/ice.cpp b/test/unitTest/ice/ice.cpp index a757423bd6..a89d12b34e 100644 --- a/test/unitTest/ice/ice.cpp +++ b/test/unitTest/ice/ice.cpp @@ -102,7 +102,7 @@ IceTest::testRawIceConnection() ice_config.tcpEnable = true; std::shared_ptr<dhtnet::IceTransport> ice_master, ice_slave; std::mutex mtx, mtx_create, mtx_resp, mtx_init; - std::unique_lock<std::mutex> lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, + std::unique_lock lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, lk_init {mtx_init}; std::condition_variable cv, cv_create, cv_resp, cv_init; std::string init = {}; @@ -197,7 +197,7 @@ IceTest::testTurnMasterIceConnection() ice_config.tcpEnable = true; std::shared_ptr<dhtnet::IceTransport> ice_master, ice_slave; std::mutex mtx, mtx_create, mtx_resp, mtx_init; - std::unique_lock<std::mutex> lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, + std::unique_lock lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, lk_init {mtx_init}; std::condition_variable cv, cv_create, cv_resp, cv_init; std::string init = {}; @@ -318,7 +318,7 @@ IceTest::testTurnSlaveIceConnection() ice_config.tcpEnable = true; std::shared_ptr<dhtnet::IceTransport> ice_master, ice_slave; std::mutex mtx, mtx_create, mtx_resp, mtx_init; - std::unique_lock<std::mutex> lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, + std::unique_lock lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, lk_init {mtx_init}; std::condition_variable cv, cv_create, cv_resp, cv_init; std::string init = {}; @@ -436,7 +436,7 @@ IceTest::testReceiveTooManyCandidates() ice_config.tcpEnable = true; std::shared_ptr<dhtnet::IceTransport> ice_master, ice_slave; std::mutex mtx, mtx_create, mtx_resp, mtx_init; - std::unique_lock<std::mutex> lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, + std::unique_lock lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, lk_init {mtx_init}; std::condition_variable cv, cv_create, cv_resp, cv_init; std::string init = {}; @@ -545,7 +545,7 @@ IceTest::testCompleteOnFailure() ice_config.tcpEnable = true; std::shared_ptr<dhtnet::IceTransport> ice_master, ice_slave; std::mutex mtx, mtx_create, mtx_resp, mtx_init; - std::unique_lock<std::mutex> lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, + std::unique_lock lk {mtx}, lk_create {mtx_create}, lk_resp {mtx_resp}, lk_init {mtx_init}; std::condition_variable cv, cv_create, cv_resp, cv_init; std::string init = {}; diff --git a/test/unitTest/ice/ice_sdp_parser.cpp b/test/unitTest/ice/ice_sdp_parser.cpp index f1b20a657a..22e5444364 100644 --- a/test/unitTest/ice/ice_sdp_parser.cpp +++ b/test/unitTest/ice/ice_sdp_parser.cpp @@ -98,7 +98,7 @@ void MediaReceiver::update(Observable<std::shared_ptr<jami::MediaFrame>>*, const std::shared_ptr<jami::MediaFrame>& frame) { - std::unique_lock<std::mutex> lock {mtx_}; + std::unique_lock lock {mtx_}; if (frame and frame->getFrame()) frameCounter_++; @@ -113,7 +113,7 @@ MediaReceiver::update(Observable<std::shared_ptr<jami::MediaFrame>>*, bool MediaReceiver::waitForMediaFlow() { - std::unique_lock<std::mutex> lock {mtx_}; + std::unique_lock lock {mtx_}; return cv_.wait_for(lock, TIME_OUT, [this] { return frameCounter_ > 100; }); } @@ -260,7 +260,7 @@ IceSdpParsingTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -295,7 +295,7 @@ IceSdpParsingTest::onCallStateChange(const std::string&, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -332,7 +332,7 @@ IceSdpParsingTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -346,7 +346,7 @@ IceSdpParsingTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {30}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/media/test_media_player.cpp b/test/unitTest/media/test_media_player.cpp index 9c91104929..8edcd64e18 100644 --- a/test/unitTest/media/test_media_player.cpp +++ b/test/unitTest/media/test_media_player.cpp @@ -64,7 +64,7 @@ private: std::shared_ptr<MediaPlayer> mediaPlayer {}; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; }; diff --git a/test/unitTest/media_negotiation/auto_answer.cpp b/test/unitTest/media_negotiation/auto_answer.cpp index b1fcd78711..bb45a39e91 100644 --- a/test/unitTest/media_negotiation/auto_answer.cpp +++ b/test/unitTest/media_negotiation/auto_answer.cpp @@ -207,7 +207,7 @@ AutoAnswerMediaNegoTestSip::tearDown() std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; auto currentAccSize = Manager::instance().getAccountList().size(); std::atomic_bool accountsRemoved {false}; @@ -398,7 +398,7 @@ AutoAnswerMediaNegoTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -425,7 +425,7 @@ AutoAnswerMediaNegoTest::onMediaChangeRequested(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::MediaChangeRequested::name)); @@ -462,7 +462,7 @@ AutoAnswerMediaNegoTest::onCallStateChange(const std::string& accountId UNUSED, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -498,7 +498,7 @@ AutoAnswerMediaNegoTest::onVideoMuted(const std::string& callId, bool muted, Cal return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::VideoMuted::name, muted ? "muted" : "un-muted")); } @@ -533,7 +533,7 @@ AutoAnswerMediaNegoTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -547,7 +547,7 @@ AutoAnswerMediaNegoTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {15}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/media_negotiation/hold_resume.cpp b/test/unitTest/media_negotiation/hold_resume.cpp index 5a50e99f1b..622ab31f81 100644 --- a/test/unitTest/media_negotiation/hold_resume.cpp +++ b/test/unitTest/media_negotiation/hold_resume.cpp @@ -211,7 +211,7 @@ HoldResumeTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -236,7 +236,7 @@ HoldResumeTest::onIncomingCall(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCall::name)); @@ -263,7 +263,7 @@ HoldResumeTest::onMediaChangeRequested(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::MediaChangeRequested::name)); @@ -297,7 +297,7 @@ HoldResumeTest::onCallStateChange(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -334,7 +334,7 @@ HoldResumeTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -348,7 +348,7 @@ HoldResumeTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {30}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/media_negotiation/media_negotiation.cpp b/test/unitTest/media_negotiation/media_negotiation.cpp index 8745bc89ee..37e4a619fc 100644 --- a/test/unitTest/media_negotiation/media_negotiation.cpp +++ b/test/unitTest/media_negotiation/media_negotiation.cpp @@ -256,7 +256,7 @@ public: { std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::atomic_bool accountsRemoved {false}; confHandlers.insert( @@ -453,7 +453,7 @@ MediaNegotiationTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -483,7 +483,7 @@ MediaNegotiationTest::onIncomingCall(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCall::name)); @@ -515,7 +515,7 @@ MediaNegotiationTest::onMediaChangeRequested(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::MediaChangeRequested::name)); @@ -537,7 +537,7 @@ MediaNegotiationTest::onCallStateChange(const std::string& accountId, CPPUNIT_ASSERT(accountId == callData.accountId_); { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -575,7 +575,7 @@ MediaNegotiationTest::onVideoMuted(const std::string& callId, bool muted, CallDa return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::VideoMuted::name, muted ? "muted" : "un-muted")); } @@ -610,7 +610,7 @@ MediaNegotiationTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -624,7 +624,7 @@ MediaNegotiationTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {30}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/namedirectory/namedirectory.cpp b/test/unitTest/namedirectory/namedirectory.cpp index 781f330b31..00ca7e875f 100644 --- a/test/unitTest/namedirectory/namedirectory.cpp +++ b/test/unitTest/namedirectory/namedirectory.cpp @@ -183,7 +183,7 @@ void NameDirectoryTest::testRegisterName() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool nameRegistered {false}; @@ -204,7 +204,7 @@ void NameDirectoryTest::testLookupName() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool nameFound {false}; @@ -226,7 +226,7 @@ void NameDirectoryTest::testLookupNameInvalid() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool nameInvalid {false}; @@ -248,7 +248,7 @@ void NameDirectoryTest::testLookupNameNotFound() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool nameNotFound {false}; @@ -270,7 +270,7 @@ void NameDirectoryTest::testLookupAddr() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool addrFound {false}; @@ -292,7 +292,7 @@ void NameDirectoryTest::testLookupAddrInvalid() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool addrInvalid {false}; @@ -314,7 +314,7 @@ void NameDirectoryTest::testLookupAddrNotFound() { std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; bool addrNotFound {false}; diff --git a/test/unitTest/plugins/plugins.cpp b/test/unitTest/plugins/plugins.cpp index 1fc9cc46ab..b97456df19 100644 --- a/test/unitTest/plugins/plugins.cpp +++ b/test/unitTest/plugins/plugins.cpp @@ -180,7 +180,7 @@ PluginsTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -202,7 +202,7 @@ PluginsTest::onCallStateChange(const std::string& accountId, CPPUNIT_ASSERT(accountId == callData.accountId_); { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -547,7 +547,7 @@ PluginsTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {30}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); @@ -691,7 +691,7 @@ PluginsTest::testMessage() // end call std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; auto messageBobReceived = 0, messageAliceReceived = 0; diff --git a/test/unitTest/presence/presence.cpp b/test/unitTest/presence/presence.cpp index 285646f45a..f9a9cc7cdf 100644 --- a/test/unitTest/presence/presence.cpp +++ b/test/unitTest/presence/presence.cpp @@ -61,7 +61,7 @@ public: UserData carlaData_; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; private: diff --git a/test/unitTest/revoke/revoke.cpp b/test/unitTest/revoke/revoke.cpp index 5a8de9cb7c..786ec52520 100644 --- a/test/unitTest/revoke/revoke.cpp +++ b/test/unitTest/revoke/revoke.cpp @@ -94,7 +94,7 @@ RevokeTest::testRevokeDevice() details[ConfProperties::ARCHIVE_PATH] = "test.gz"; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; auto deviceRevoked = false; @@ -131,7 +131,7 @@ RevokeTest::testRevokeInvalidDevice() auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; auto revokeFailed = false; diff --git a/test/unitTest/scheduler.cpp b/test/unitTest/scheduler.cpp index 446d612a87..b65674f1cd 100644 --- a/test/unitTest/scheduler.cpp +++ b/test/unitTest/scheduler.cpp @@ -51,7 +51,7 @@ SchedulerTest::schedulerTest() constexpr unsigned N = 1024; std::mutex mtx; std::condition_variable cv; - std::unique_lock<std::mutex> lk(mtx); + std::unique_lock lk(mtx); std::atomic_uint64_t taskRun {0}; std::atomic_uint64_t result {0}; diff --git a/test/unitTest/sip_account/sip_basic_calls.cpp b/test/unitTest/sip_account/sip_basic_calls.cpp index 0722f8c958..ac7da4e06a 100644 --- a/test/unitTest/sip_account/sip_basic_calls.cpp +++ b/test/unitTest/sip_account/sip_basic_calls.cpp @@ -183,7 +183,7 @@ SipBasicCallTest::tearDown() std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::atomic_bool accountsRemoved {false}; confHandlers.insert( @@ -277,7 +277,7 @@ SipBasicCallTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -299,7 +299,7 @@ SipBasicCallTest::onCallStateChange(const std::string& accountId, CPPUNIT_ASSERT(accountId == callData.accountId_); { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -337,7 +337,7 @@ SipBasicCallTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -351,7 +351,7 @@ SipBasicCallTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {10}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/sip_account/sip_srtp.cpp b/test/unitTest/sip_account/sip_srtp.cpp index 48276aa53c..375f575e1d 100644 --- a/test/unitTest/sip_account/sip_srtp.cpp +++ b/test/unitTest/sip_account/sip_srtp.cpp @@ -157,7 +157,7 @@ SipSrtpTest::tearDown() std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; auto currentAccSize = Manager::instance().getAccountList().size(); std::atomic_bool accountsRemoved {false}; @@ -222,7 +222,7 @@ SipSrtpTest::onIncomingCallWithMedia(const std::string& accountId, return; } - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.callId_ = callId; callData.signals_.emplace_back(CallData::Signal(libjami::CallSignal::IncomingCallWithMedia::name)); @@ -257,7 +257,7 @@ SipSrtpTest::onCallStateChange(const std::string&, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::StateChange::name, state)); } @@ -295,7 +295,7 @@ SipSrtpTest::onMediaNegotiationStatus(const std::string& callId, return; { - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; callData.signals_.emplace_back( CallData::Signal(libjami::CallSignal::MediaNegotiationStatus::name, event)); } @@ -309,7 +309,7 @@ SipSrtpTest::waitForSignal(CallData& callData, const std::string& expectedEvent) { const std::chrono::seconds TIME_OUT {30}; - std::unique_lock<std::mutex> lock {callData.mtx_}; + std::unique_lock lock {callData.mtx_}; // Combined signal + event (if any). std::string sigEvent(expectedSignal); diff --git a/test/unitTest/swarm/bootstrap.cpp b/test/unitTest/swarm/bootstrap.cpp index 8ee1b504f5..e367aae37e 100644 --- a/test/unitTest/swarm/bootstrap.cpp +++ b/test/unitTest/swarm/bootstrap.cpp @@ -215,7 +215,7 @@ BootstrapTest::testBootstrapOk() cv.notify_one(); }); - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto convId = libjami::startConversation(aliceData.accountId); libjami::addConversationMember(aliceData.accountId, convId, bobUri); @@ -243,7 +243,7 @@ BootstrapTest::testBootstrapFailed() cv.notify_one(); }); - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto convId = libjami::startConversation(aliceData.accountId); libjami::addConversationMember(aliceData.accountId, convId, bobUri); @@ -278,7 +278,7 @@ BootstrapTest::testBootstrapNeverNewDevice() cv.notify_one(); }); - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto convId = libjami::startConversation(aliceData.accountId); libjami::addConversationMember(aliceData.accountId, convId, bobUri); @@ -366,7 +366,7 @@ BootstrapTest::testBootstrapCompat() ->disableSwarmManager = true; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; auto convId = libjami::startConversation(aliceData.accountId); libjami::addConversationMember(aliceData.accountId, convId, bobUri); diff --git a/test/unitTest/swarm/routing_table.cpp b/test/unitTest/swarm/routing_table.cpp index 418367d5f3..50a8b6a6ba 100644 --- a/test/unitTest/swarm/routing_table.cpp +++ b/test/unitTest/swarm/routing_table.cpp @@ -64,12 +64,12 @@ struct Counter } bool wait(std::chrono::steady_clock::duration timeout) { - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); return cv.wait_for(lock, timeout, [&] { return added == target; }); } void wait() { - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); return cv.wait(lock, [&] { return added == target; }); } }; @@ -522,7 +522,7 @@ RoutingTableTest::testSwarmManagerConnectingNodes_1b() {NodeId("053927d831827a9f7e606d4c9c9fe833922c0d35b3960dd2250085f46c0e4f41"), NodeId("41a05179e4b3e42c3409b10280bb448d5bbd5ef64784b997d2d1663457bb6ba8")}); - std::unique_lock<std::mutex> lk(mutex); + std::unique_lock lk(mutex); sm1->setKnownNodes(toTest); CPPUNIT_ASSERT(cv.wait_for(lk, 10s, [&](){return tryConnect.size() != 0 && needSocketNodes.size() != 0;})); diff --git a/test/unitTest/swarm/swarm_conversation.cpp b/test/unitTest/swarm/swarm_conversation.cpp index c38a21d756..2085ac20af 100644 --- a/test/unitTest/swarm/swarm_conversation.cpp +++ b/test/unitTest/swarm/swarm_conversation.cpp @@ -67,7 +67,7 @@ public: std::vector<std::string> accountIds; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; private: @@ -162,7 +162,7 @@ SwarmConversationTest::testSendMessage() } std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; connectSignals(); diff --git a/test/unitTest/swarm/swarm_spread.cpp b/test/unitTest/swarm/swarm_spread.cpp index 3736e87a7e..99c9bbf909 100644 --- a/test/unitTest/swarm/swarm_spread.cpp +++ b/test/unitTest/swarm/swarm_spread.cpp @@ -80,12 +80,12 @@ struct Counter } bool wait(std::chrono::steady_clock::duration timeout) { - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); return cv.wait_for(lock, timeout, [&] { return added == target; }); } void wait() { - std::unique_lock<std::mutex> lock(mutex); + std::unique_lock lock(mutex); return cv.wait(lock, [&] { return added == target; }); } }; @@ -284,7 +284,7 @@ SwarmMessageSpread::needSocketCallBack(const std::shared_ptr<SwarmManager>& sm) NodeId node = dhtnet::DeviceId(nodeId); if (auto smRemote = getManager(node)) { auto myId = sm->getId(); - std::unique_lock<std::mutex> lk(channelSocketsMtx_); + std::unique_lock lk(channelSocketsMtx_); auto& cstRemote = channelSockets_[node][myId]; auto& cstMe = channelSockets_[myId][node]; if (cstMe.second && cstMe.first) @@ -419,7 +419,7 @@ SwarmMessageSpread::testWriteMessage() } } - std::unique_lock<std::mutex> lk(channelSocketsMtx_); + std::unique_lock lk(channelSocketsMtx_); bool ok = channelSocketsCv_.wait_for(lk, 1200s, [&] { std::cout << "\r" << "Size of Received " << numberTimesReceived.size(); diff --git a/test/unitTest/syncHistory/syncHistory.cpp b/test/unitTest/syncHistory/syncHistory.cpp index f3ba61e55d..ecc5fc9923 100644 --- a/test/unitTest/syncHistory/syncHistory.cpp +++ b/test/unitTest/syncHistory/syncHistory.cpp @@ -83,7 +83,7 @@ public: UserData alice2Data; std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; void connectSignals(); @@ -475,7 +475,7 @@ SyncHistoryTest::testCreateMultipleConversationThenAddDevice() alice2Id = Manager::instance().addAccount(details); std::mutex mtx; - std::unique_lock<std::mutex> lk {mtx}; + std::unique_lock lk {mtx}; std::condition_variable cv; std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; std::atomic_int conversationReady = 0; -- GitLab