Use locks on check_events for threaded case
This commit is contained in:
parent
3b4ae6e7dd
commit
0f1e9c9aed
1 changed files with 10 additions and 1 deletions
|
@ -225,7 +225,11 @@ void UDPC_set_callback_received(
|
||||||
|
|
||||||
void UDPC_check_events(UDPC_Context *ctx)
|
void UDPC_check_events(UDPC_Context *ctx)
|
||||||
{
|
{
|
||||||
// TODO use a lock on receivedPackets
|
if((ctx->flags & 0x1) != 0)
|
||||||
|
{
|
||||||
|
mtx_lock(&ctx->tCVMtx);
|
||||||
|
}
|
||||||
|
|
||||||
if(ctx->callbackConnected)
|
if(ctx->callbackConnected)
|
||||||
{
|
{
|
||||||
for(int x = 0; x * 4 < ctx->connectedEvents->size; ++x)
|
for(int x = 0; x * 4 < ctx->connectedEvents->size; ++x)
|
||||||
|
@ -278,6 +282,11 @@ void UDPC_check_events(UDPC_Context *ctx)
|
||||||
}
|
}
|
||||||
UDPC_Deque_clear(ctx->receivedPackets);
|
UDPC_Deque_clear(ctx->receivedPackets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((ctx->flags & 0x1) != 0)
|
||||||
|
{
|
||||||
|
mtx_unlock(&ctx->tCVMtx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPC_queue_send(UDPC_Context *ctx, uint32_t addr, uint32_t isChecked, void *data, uint32_t size)
|
int UDPC_queue_send(UDPC_Context *ctx, uint32_t addr, uint32_t isChecked, void *data, uint32_t size)
|
||||||
|
|
Loading…
Reference in a new issue