@@ -533,12 +533,12 @@ static bool resolve_deadlocks(void)
533533 //
534534 zend_long fiber_coroutines_count = 0 ;
535535
536- ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value ) {
536+ ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value )
537+ {
537538 const zend_coroutine_t * coroutine = (zend_coroutine_t * ) Z_PTR_P (value );
538539
539- if (ZEND_COROUTINE_IS_FIBER (coroutine )
540- && ZEND_COROUTINE_IS_YIELD (coroutine )
541- && coroutine -> extended_data != NULL ) {
540+ if (ZEND_COROUTINE_IS_FIBER (coroutine ) && ZEND_COROUTINE_IS_YIELD (coroutine ) &&
541+ coroutine -> extended_data != NULL ) {
542542 fiber_coroutines_count ++ ;
543543 }
544544 }
@@ -550,13 +550,13 @@ static bool resolve_deadlocks(void)
550550 //
551551 if (fiber_coroutines_count == real_coroutines ) {
552552
553- ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value ) {
553+ ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value )
554+ {
554555 zend_coroutine_t * coroutine = (zend_coroutine_t * ) Z_PTR_P (value );
555556
556- if (ZEND_COROUTINE_IS_FIBER (coroutine )
557- && ZEND_COROUTINE_IS_YIELD (coroutine )
558- && coroutine -> extended_data != NULL ) {
559- ZEND_ASYNC_CANCEL (coroutine , zend_create_graceful_exit (), true);
557+ if (ZEND_COROUTINE_IS_FIBER (coroutine ) && ZEND_COROUTINE_IS_YIELD (coroutine ) &&
558+ coroutine -> extended_data != NULL ) {
559+ ZEND_ASYNC_CANCEL (coroutine , zend_create_graceful_exit (), true);
560560
561561 if (UNEXPECTED (EG (exception ) != NULL )) {
562562 return true;
@@ -568,8 +568,10 @@ static bool resolve_deadlocks(void)
568568 }
569569
570570 // Create deadlock exception to be set as exit_exception
571- zend_object * deadlock_exception = async_new_exception (async_ce_deadlock_error ,
572- "Deadlock detected: no active coroutines, %u coroutines in waiting" , real_coroutines );
571+ zend_object * deadlock_exception =
572+ async_new_exception (async_ce_deadlock_error ,
573+ "Deadlock detected: no active coroutines, %u coroutines in waiting" ,
574+ real_coroutines );
573575
574576 // Set as exit exception if there isn't one already
575577 if (ZEND_ASYNC_EXIT_EXCEPTION == NULL ) {
@@ -580,7 +582,8 @@ static bool resolve_deadlocks(void)
580582 ZEND_ASYNC_EXIT_EXCEPTION = deadlock_exception ;
581583 }
582584
583- ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value ) {
585+ ZEND_HASH_FOREACH_VAL (& ASYNC_G (coroutines ), value )
586+ {
584587 async_coroutine_t * coroutine = (async_coroutine_t * ) Z_PTR_P (value );
585588
586589 ZEND_ASSERT (coroutine -> coroutine .waker != NULL && "The Coroutine has no waker object" );
@@ -1061,8 +1064,8 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine)
10611064
10621065 // Behavior for a new coroutine
10631066 // see: async_API.c spawn(zend_async_scope_t *scope, zend_object *scope_provider, int32_t priority)
1064- if (false == ZEND_COROUTINE_IS_STARTED (coroutine )
1065- && zend_hash_index_find (& ASYNC_G (coroutines ), ((async_coroutine_t * )coroutine )-> std .handle ) == NULL ) {
1067+ if (false == ZEND_COROUTINE_IS_STARTED (coroutine ) &&
1068+ zend_hash_index_find (& ASYNC_G (coroutines ), ((async_coroutine_t * ) coroutine )-> std .handle ) == NULL ) {
10661069 // save the filename and line number where the coroutine was created
10671070 zend_apply_current_filename_and_line (& coroutine -> filename , & coroutine -> lineno );
10681071
@@ -1076,7 +1079,9 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine)
10761079 return false;
10771080 }
10781081
1079- if (UNEXPECTED (zend_hash_index_add_ptr (& ASYNC_G (coroutines ), ((async_coroutine_t * )coroutine )-> std .handle , coroutine ) == NULL )) {
1082+ if (UNEXPECTED (zend_hash_index_add_ptr (& ASYNC_G (coroutines ),
1083+ ((async_coroutine_t * ) coroutine )-> std .handle ,
1084+ coroutine ) == NULL )) {
10801085 coroutine -> waker -> status = ZEND_ASYNC_WAKER_IGNORED ;
10811086 async_throw_error ("Failed to add coroutine to the list" );
10821087 return false;
@@ -1144,7 +1149,8 @@ static zend_always_inline void scheduler_next_tick(void)
11441149 // Fast return path without context switching...
11451150 zend_coroutine_t * coroutine = ZEND_ASYNC_CURRENT_COROUTINE ;
11461151
1147- if (UNEXPECTED (coroutine != NULL && coroutine -> waker != NULL && coroutine -> waker -> status == ZEND_ASYNC_WAKER_RESULT )) {
1152+ if (UNEXPECTED (coroutine != NULL && coroutine -> waker != NULL &&
1153+ coroutine -> waker -> status == ZEND_ASYNC_WAKER_RESULT )) {
11481154 return ;
11491155 }
11501156
0 commit comments