@@ -307,12 +307,14 @@ void vCoRoutineSchedule( void );
307307 * \defgroup crDELAY crDELAY
308308 * \ingroup Tasks
309309 */
310- #define crDELAY ( xHandle , xTicksToDelay ) \
311- if( ( xTicksToDelay ) > 0 ) \
312- { \
313- vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
314- } \
315- crSET_STATE0( ( xHandle ) );
310+ #define crDELAY ( xHandle , xTicksToDelay ) \
311+ do { \
312+ if( ( xTicksToDelay ) > 0 ) \
313+ { \
314+ vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
315+ } \
316+ crSET_STATE0( ( xHandle ) ); \
317+ } while( 0 )
316318
317319/**
318320 * @code{c}
@@ -400,7 +402,7 @@ void vCoRoutineSchedule( void );
400402 * \ingroup Tasks
401403 */
402404#define crQUEUE_SEND ( xHandle , pxQueue , pvItemToQueue , xTicksToWait , pxResult ) \
403- { \
405+ do { \
404406 *( pxResult ) = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), ( xTicksToWait ) ); \
405407 if( *( pxResult ) == errQUEUE_BLOCKED ) \
406408 { \
@@ -412,7 +414,7 @@ void vCoRoutineSchedule( void );
412414 crSET_STATE1( ( xHandle ) ); \
413415 *pxResult = pdPASS; \
414416 } \
415- }
417+ } while( 0 )
416418
417419/**
418420 * croutine. h
@@ -494,7 +496,7 @@ void vCoRoutineSchedule( void );
494496 * \ingroup Tasks
495497 */
496498#define crQUEUE_RECEIVE ( xHandle , pxQueue , pvBuffer , xTicksToWait , pxResult ) \
497- { \
499+ do { \
498500 *( pxResult ) = xQueueCRReceive( ( pxQueue ), ( pvBuffer ), ( xTicksToWait ) ); \
499501 if( *( pxResult ) == errQUEUE_BLOCKED ) \
500502 { \
@@ -506,7 +508,7 @@ void vCoRoutineSchedule( void );
506508 crSET_STATE1( ( xHandle ) ); \
507509 *( pxResult ) = pdPASS; \
508510 } \
509- }
511+ } while( 0 )
510512
511513/**
512514 * croutine. h
0 commit comments