Merge pull request #1401 from nfedera/fix-2013-08-07-02

libwinpr-utils: Use criticalsection with spincount
This commit is contained in:
Marc-André Moreau 2013-08-07 12:35:46 -07:00
commit 331933635c
10 changed files with 10 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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