Merge pull request #44 from defold/buffer-threading-fix

Fixed threading issue of checking if command buffer is empty
This commit is contained in:
Mathias Westerdahl 2021-09-07 14:34:35 +02:00 committed by GitHub
commit bda785ef08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,13 +121,14 @@ void IAP_Queue_Push(IAPCommandQueue* queue, IAPCommand* cmd)
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
{
assert(fn != 0);
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
if (queue->m_Commands.Empty())
{
return;
}
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
{
fn(&queue->m_Commands[i], ctx);