mirror of
https://github.com/defold/extension-iap
synced 2025-06-27 02:17:51 +02:00
Merge pull request #44 from defold/buffer-threading-fix
Fixed threading issue of checking if command buffer is empty
This commit is contained in:
commit
bda785ef08
@ -121,13 +121,14 @@ void IAP_Queue_Push(IAPCommandQueue* queue, IAPCommand* cmd)
|
|||||||
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
|
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
|
||||||
{
|
{
|
||||||
assert(fn != 0);
|
assert(fn != 0);
|
||||||
|
|
||||||
|
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
|
||||||
|
|
||||||
if (queue->m_Commands.Empty())
|
if (queue->m_Commands.Empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
|
|
||||||
|
|
||||||
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
|
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
|
||||||
{
|
{
|
||||||
fn(&queue->m_Commands[i], ctx);
|
fn(&queue->m_Commands[i], ctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user