mirror of https://github.com/FreeRDP/FreeRDP
winpr/synch/barrier: fix return value and test
- According to the msdn docs DeleteSynchronizationBarrier always returns TRUE - Added additional error checks to the barrier test
This commit is contained in:
parent
85f44262de
commit
2dba082587
|
@ -228,8 +228,14 @@ BOOL WINAPI DeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrier)
|
||||||
return pfnDeleteSynchronizationBarrier(lpBarrier);
|
return pfnDeleteSynchronizationBarrier(lpBarrier);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* According to https://msdn.microsoft.com/en-us/library/windows/desktop/hh706887(v=vs.85).aspx
|
||||||
|
* Return value:
|
||||||
|
* The DeleteSynchronizationBarrier function always returns TRUE.
|
||||||
|
*/
|
||||||
|
|
||||||
if (!lpBarrier)
|
if (!lpBarrier)
|
||||||
return FALSE;
|
return TRUE;
|
||||||
|
|
||||||
while (lpBarrier->Reserved1 != lpBarrier->Reserved2)
|
while (lpBarrier->Reserved1 != lpBarrier->Reserved2)
|
||||||
SwitchToThread();
|
SwitchToThread();
|
||||||
|
|
|
@ -95,7 +95,12 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags)
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
SetEvent(gStartEvent);
|
if (!SetEvent(gStartEvent))
|
||||||
|
{
|
||||||
|
printf("%s: SetEvent(gStartEvent) failed with error = 0x%08x)\n",
|
||||||
|
__FUNCTION__, GetLastError());
|
||||||
|
InterlockedIncrement(&gErrorCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (WAIT_OBJECT_0 != (dwStatus = WaitForMultipleObjects(i, threads, TRUE, INFINITE)))
|
if (WAIT_OBJECT_0 != (dwStatus = WaitForMultipleObjects(i, threads, TRUE, INFINITE)))
|
||||||
{
|
{
|
||||||
|
@ -105,7 +110,13 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(gStartEvent);
|
if (!CloseHandle(gStartEvent))
|
||||||
|
{
|
||||||
|
printf("%s: CloseHandle(gStartEvent) failed with error = 0x%08x)\n",
|
||||||
|
__FUNCTION__, GetLastError());
|
||||||
|
InterlockedIncrement(&gErrorCount);
|
||||||
|
}
|
||||||
|
|
||||||
DeleteSynchronizationBarrier(&gBarrier);
|
DeleteSynchronizationBarrier(&gBarrier);
|
||||||
|
|
||||||
if (gTrueCount != EXPECTED_TRUE_COUNT)
|
if (gTrueCount != EXPECTED_TRUE_COUNT)
|
||||||
|
|
Loading…
Reference in New Issue