@@ -15,12 +15,12 @@ namespace AzNetworking
|
||||
, m_startOffset(startOffset)
|
||||
, m_count(startOffset < bitset.GetValidBitCount() && startOffset + count <= bitset.GetValidBitCount() ? count : 0)
|
||||
{
|
||||
AZ_Assert(startOffset + count <= bitset.GetValidBitCount(), "Out of bounds setup in BitsetSubset. Defaulting to 0 bit count.");
|
||||
AZ_Warning("FixedSizeBitsetView", startOffset + count <= bitset.GetValidBitCount(), "Out of bounds setup in BitsetSubset. Defaulting to 0 bit count.");
|
||||
}
|
||||
|
||||
inline void FixedSizeBitsetView::SetBit(uint32_t index, bool value)
|
||||
{
|
||||
AZ_Assert(index < m_count, "Out of bounds access in BitsetSubset (requested %u, count %u)", index, m_count);
|
||||
AZ_Warning("FixedSizeBitsetView", index < m_count, "Out of bounds access in BitsetSubset (requested %u, count %u)", index, m_count);
|
||||
if (m_count)
|
||||
{
|
||||
m_bitset.SetBit(m_startOffset + index, value);
|
||||
@@ -29,7 +29,7 @@ namespace AzNetworking
|
||||
|
||||
inline bool FixedSizeBitsetView::GetBit(uint32_t index) const
|
||||
{
|
||||
AZ_Assert(index < m_count, "Out of bounds access in BitsetSubset (requested %u, count %u)", index, m_count);
|
||||
AZ_Warning("FixedSizeBitsetView", index < m_count, "Out of bounds access in BitsetSubset (requested %u, count %u)", index, m_count);
|
||||
if (m_count)
|
||||
{
|
||||
return m_bitset.GetBit(m_startOffset + index);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzNetworking
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/typetraits/is_same.h>
|
||||
#include <AzCore/std/typetraits/is_enum.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/RTTI/TypeSafeIntegral.h>
|
||||
#include <AzCore/Name/Name.h>
|
||||
#include <AzCore/Name/NameDictionary.h>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzNetworking/Utilities/IpAddress.h>
|
||||
#include <AzNetworking/ConnectionLayer/IConnectionSet.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
|
||||
namespace AzNetworking
|
||||
{
|
||||
|
||||
@@ -26,27 +26,29 @@ namespace AzNetworking
|
||||
{
|
||||
m_running = true;
|
||||
m_joinable = true;
|
||||
m_thread = AZStd::thread([this]()
|
||||
{
|
||||
OnStart();
|
||||
while (m_running)
|
||||
m_thread = AZStd::thread(
|
||||
m_threadDesc,
|
||||
[this]()
|
||||
{
|
||||
const AZ::TimeMs startTimeMs = AZ::GetElapsedTimeMs();
|
||||
OnUpdate(m_updateRate);
|
||||
const AZ::TimeMs updateTimeMs = AZ::GetElapsedTimeMs() - startTimeMs;
|
||||
OnStart();
|
||||
while (m_running)
|
||||
{
|
||||
const AZ::TimeMs startTimeMs = AZ::GetElapsedTimeMs();
|
||||
OnUpdate(m_updateRate);
|
||||
const AZ::TimeMs updateTimeMs = AZ::GetElapsedTimeMs() - startTimeMs;
|
||||
|
||||
if (m_updateRate > updateTimeMs)
|
||||
{
|
||||
AZStd::chrono::milliseconds sleepTimeMs(static_cast<int64_t>(m_updateRate - updateTimeMs));
|
||||
AZStd::this_thread::sleep_for(sleepTimeMs);
|
||||
if (m_updateRate > updateTimeMs)
|
||||
{
|
||||
AZStd::chrono::milliseconds sleepTimeMs(static_cast<int64_t>(m_updateRate - updateTimeMs));
|
||||
AZStd::this_thread::sleep_for(sleepTimeMs);
|
||||
}
|
||||
else if (m_updateRate < updateTimeMs)
|
||||
{
|
||||
AZLOG(NET_TimedThread, "TimedThread bled %d ms", aznumeric_cast<int32_t>(updateTimeMs - m_updateRate));
|
||||
}
|
||||
}
|
||||
else if (m_updateRate < updateTimeMs)
|
||||
{
|
||||
AZLOG(NET_TimedThread, "TimedThread bled %d ms", aznumeric_cast<int32_t>(updateTimeMs - m_updateRate));
|
||||
}
|
||||
}
|
||||
OnStop();
|
||||
}, &m_threadDesc);
|
||||
OnStop();
|
||||
});
|
||||
}
|
||||
|
||||
void TimedThread::Stop()
|
||||
|
||||
Reference in New Issue
Block a user