27 Nov
2018
27 Nov
'18
6:58 a.m.
Zebediah Figura <z.figura12(a)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. -- Dmitry.