[winpr,utils] Set Queue_Enqueue only once
In #10527 performance was measured and SetEvent did take a lot of time in these measurements. The reset is only required once though, so use a more fine grained trigger condition.
This commit is contained in:
parent
d0addb52bd
commit
efde29f362
@ -215,8 +215,12 @@ BOOL Queue_Enqueue(wQueue* queue, const void* obj)
|
|||||||
queue->array[queue->tail] = cnv.v;
|
queue->array[queue->tail] = cnv.v;
|
||||||
}
|
}
|
||||||
queue->tail = (queue->tail + 1) % queue->capacity;
|
queue->tail = (queue->tail + 1) % queue->capacity;
|
||||||
|
|
||||||
|
const BOOL signalSet = queue->size == 0;
|
||||||
queue->size++;
|
queue->size++;
|
||||||
SetEvent(queue->event);
|
|
||||||
|
if (signalSet)
|
||||||
|
SetEvent(queue->event);
|
||||||
out:
|
out:
|
||||||
|
|
||||||
Queue_Unlock(queue);
|
Queue_Unlock(queue);
|
||||||
|
Loading…
Reference in New Issue
Block a user