[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:
akallabeth 2024-08-29 08:29:33 +02:00
parent d0addb52bd
commit efde29f362
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -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);