Fixed issue with the ring buffer's write incrementation.

This commit is contained in:
PS 2021-01-30 14:09:19 -08:00
parent cd6bee6d7e
commit 84854b2ad8
1 changed files with 4 additions and 4 deletions

View File

@ -151,10 +151,6 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
(BLState->OutgoingMsgQueue.WriteHead < BLState->OutgoingMsgQueue.ReadHead))
{
u32 WriteIndex = BLState->OutgoingMsgQueue.WriteHead;
if (BLState->OutgoingMsgQueue.WriteHead >= BLUMEN_MESSAGE_QUEUE_COUNT)
{
BLState->OutgoingMsgQueue.WriteHead = 0;
}
gs_data* Msg = BLState->OutgoingMsgQueue.Buffers + WriteIndex;
if (Msg->Size == 0)
@ -174,6 +170,10 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
// 3. Network Thread sends the message at 0
// 4. Main Thread sets the message at 0
BLState->OutgoingMsgQueue.WriteHead += 1;
if (BLState->OutgoingMsgQueue.WriteHead >= BLUMEN_MESSAGE_QUEUE_COUNT)
{
BLState->OutgoingMsgQueue.WriteHead = 0;
}
}
}