From bf607e4c9cc634f6c383913c7be8ae2a1d340114 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 19 Mar 2015 15:53:16 -0700 Subject: [PATCH] Fixing indentation and usage --- assignment-client/src/avatars/AvatarMixer.cpp | 8 ++++---- libraries/shared/src/TryLocker.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 151a9f8861..176fd51eea 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -135,7 +135,7 @@ void AvatarMixer::broadcastAvatarData() { [&](const SharedNodePointer& node) { AvatarMixerClientData* nodeData = reinterpret_cast(node->getLinkedData()); MutexTryLocker lock(nodeData->getMutex()); - if (!lock.tryLock()) { + if (!lock.isLocked()) { return; } ++_sumListeners; @@ -149,7 +149,7 @@ void AvatarMixer::broadcastAvatarData() { // about a given otherNode to this node // FIXME does this mean we should sort the othernodes by distance before iterating // over them? - float outputBandwidth = node->getBandwidthRecorder().getTotalAverageOutputKilobitsPerSecond(); + float outputBandwidth = node->getOutboundBandwidth(); // this is an AGENT we have received head data from // send back a packet with other active node data to this node @@ -164,14 +164,14 @@ void AvatarMixer::broadcastAvatarData() { // Check throttling value if (!(_performanceThrottlingRatio == 0 || randFloat() < (1.0f - _performanceThrottlingRatio))) { - return; + return false; } return true; }, [&](const SharedNodePointer& otherNode) { AvatarMixerClientData* otherNodeData = otherNodeData = reinterpret_cast(otherNode->getLinkedData()); MutexTryLocker lock(otherNodeData->getMutex()); - if (!lock.tryLock()) { + if (!lock.isLocked()) { return; } AvatarData& otherAvatar = otherNodeData->getAvatar(); diff --git a/libraries/shared/src/TryLocker.h b/libraries/shared/src/TryLocker.h index c5328b3b3a..f4b90575f1 100644 --- a/libraries/shared/src/TryLocker.h +++ b/libraries/shared/src/TryLocker.h @@ -15,14 +15,14 @@ #include class MutexTryLocker { - QMutex & _mutex; - bool _locked{false}; + QMutex & _mutex; + bool _locked{ false }; public: - MutexTryLocker(QMutex &m) : _mutex(m), _locked(m.tryLock()) {} - ~MutexTryLocker() { if (_locked) _mutex.unlock(); } - bool isLocked() { - return _locked; - } -} + MutexTryLocker(QMutex &m) : _mutex(m), _locked(m.tryLock()) {} + ~MutexTryLocker() { if (_locked) _mutex.unlock(); } + bool isLocked() { + return _locked; + } +}; -#endif // hifi_UUID_h +#endif // hifi_TryLocker_h