Zebediah Figura z.figura12@gmail.com wrote:
case TYPE_SEMAPHORE:
{
KSEMAPHORE *semaphore = CONTAINING_RECORD(objs[i], KSEMAPHORE, Header);
objs[i]->WaitListHead.Blink = CreateSemaphoreW( NULL,
semaphore->Header.SignalState, semaphore->Limit, NULL );
break;
}
...
- EnterCriticalSection( &sync_cs );
- ret = InterlockedExchangeAdd( &semaphore->Header.SignalState, count );
- if (handle)
ReleaseSemaphore( handle, count, NULL );
- LeaveCriticalSection( &sync_cs );
Wouldn't it be better to use native instead of win32 APIs? This way you would be able to propagate errors instead of ignoring them.