Merge pull request #1401 from nfedera/fix-2013-08-07-02
libwinpr-utils: Use criticalsection with spincount
This commit is contained in:
commit
331933635c
@ -390,7 +390,7 @@ wArrayList* ArrayList_New(BOOL synchronized)
|
||||
|
||||
arrayList->array = (void**) malloc(sizeof(void*) * arrayList->capacity);
|
||||
|
||||
InitializeCriticalSection(&arrayList->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&arrayList->lock, 4000);
|
||||
|
||||
ZeroMemory(&arrayList->object, sizeof(wObject));
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ wBufferPool* BufferPool_New(BOOL synchronized, int fixedSize, DWORD alignment)
|
||||
pool->synchronized = synchronized;
|
||||
|
||||
if (pool->synchronized)
|
||||
InitializeCriticalSection(&pool->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&pool->lock, 4000);
|
||||
|
||||
if (!pool->fixedSize)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ wCountdownEvent* CountdownEvent_New(DWORD initialCount)
|
||||
{
|
||||
countdown->count = initialCount;
|
||||
countdown->initialCount = initialCount;
|
||||
InitializeCriticalSection(&countdown->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&countdown->lock, 4000);
|
||||
countdown->event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
if (countdown->count == 0)
|
||||
|
@ -194,7 +194,7 @@ wMessageQueue* MessageQueue_New()
|
||||
queue->array = (wMessage*) malloc(sizeof(wMessage) * queue->capacity);
|
||||
ZeroMemory(queue->array, sizeof(wMessage) * queue->capacity);
|
||||
|
||||
InitializeCriticalSection(&queue->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&queue->lock, 4000);
|
||||
queue->event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ wObjectPool* ObjectPool_New(BOOL synchronized)
|
||||
pool->synchronized = synchronized;
|
||||
|
||||
if (pool->synchronized)
|
||||
InitializeCriticalSection(&pool->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&pool->lock, 4000);
|
||||
|
||||
pool->size = 0;
|
||||
pool->capacity = 32;
|
||||
|
@ -202,7 +202,7 @@ wPubSub* PubSub_New(BOOL synchronized)
|
||||
pubSub->synchronized = synchronized;
|
||||
|
||||
if (pubSub->synchronized)
|
||||
InitializeCriticalSection(&pubSub->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&pubSub->lock, 4000);
|
||||
|
||||
pubSub->count = 0;
|
||||
pubSub->size = 64;
|
||||
|
@ -243,7 +243,7 @@ wQueue* Queue_New(BOOL synchronized, int capacity, int growthFactor)
|
||||
queue->array = (void**) malloc(sizeof(void*) * queue->capacity);
|
||||
ZeroMemory(queue->array, sizeof(void*) * queue->capacity);
|
||||
|
||||
InitializeCriticalSection(&queue->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&queue->lock, 4000);
|
||||
queue->event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
ZeroMemory(&queue->object, sizeof(wObject));
|
||||
|
@ -154,7 +154,7 @@ wReferenceTable* ReferenceTable_New(BOOL synchronized, void* context, REFERENCE_
|
||||
ZeroMemory(referenceTable->array, sizeof(wReference) * referenceTable->size);
|
||||
|
||||
referenceTable->synchronized = synchronized;
|
||||
InitializeCriticalSection(&referenceTable->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&referenceTable->lock, 4000);
|
||||
}
|
||||
|
||||
return referenceTable;
|
||||
|
@ -153,7 +153,7 @@ wStack* Stack_New(BOOL synchronized)
|
||||
stack->synchronized = synchronized;
|
||||
|
||||
if (stack->synchronized)
|
||||
InitializeCriticalSection(&stack->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&stack->lock, 4000);
|
||||
|
||||
stack->size = 0;
|
||||
stack->capacity = 32;
|
||||
|
@ -323,7 +323,7 @@ wStreamPool* StreamPool_New(BOOL synchronized, size_t defaultSize)
|
||||
pool->synchronized = synchronized;
|
||||
pool->defaultSize = defaultSize;
|
||||
|
||||
InitializeCriticalSection(&pool->lock);
|
||||
InitializeCriticalSectionAndSpinCount(&pool->lock, 4000);
|
||||
|
||||
pool->aSize = 0;
|
||||
pool->aCapacity = 32;
|
||||
|
Loading…
Reference in New Issue
Block a user