mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-23 09:00:29 +02:00
Fix risk of Win32 timer setup call getting ignored (#1311)
If a user configures the configASSERT macro to expand to nothing, a call to the Win32 API SetWaitableTimer() doesn't get compiled. This can happen if, for example, configASSERT(x) set defined as assert(x) (from assert.h) which expands to nothing when NDEBUG is set (common for "release" builds).
This commit is contained in:
parent
386c1bca66
commit
ccabdec2f8
@ -152,6 +152,7 @@ static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
|
||||
TickType_t xWaitTimeBetweenTicks = portTICK_PERIOD_MS;
|
||||
HANDLE hTimer = NULL;
|
||||
LARGE_INTEGER liDueTime;
|
||||
BOOL bSuccess;
|
||||
|
||||
/* Set the timer resolution to the maximum possible. */
|
||||
if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR )
|
||||
@ -190,7 +191,8 @@ static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
|
||||
|
||||
/* Set the Waitable Timer. The timer is set to run periodically at every
|
||||
xWaitTimeBetweenTicks milliseconds. */
|
||||
configASSERT( SetWaitableTimer( hTimer, &liDueTime, xWaitTimeBetweenTicks, NULL, NULL, 0 ) );
|
||||
bSuccess = SetWaitableTimer( hTimer, &liDueTime, xWaitTimeBetweenTicks, NULL, NULL, 0 );
|
||||
configASSERT( bSuccess );
|
||||
|
||||
while( xPortRunning == pdTRUE )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user