@@ -481,7 +481,7 @@ CURLcode curl_async_perform(CURL* curl)
481481/// - multi_timer_cb → creates timer event
482482/// 7. When socket ready or timer fires → notify Waker
483483/// 8. Coroutine resumes
484- ///
484+ ///
485485/// ⚠️ IMPORTANT: Multiple coroutines can simultaneously wait on same php_curlm!
486486/// Each select() creates its own Waker, but all use same curl_multi_event
487487///////////////////////////////////////////////////////////////
@@ -501,23 +501,22 @@ static bool curl_async_multi_event_remove_callback(zend_async_event_t *event, ze
501501 return zend_async_callbacks_remove (event , callback );
502502}
503503
504- static void curl_async_multi_event_start (zend_async_event_t * event )
504+ static bool curl_async_multi_event_start (zend_async_event_t * event )
505505{
506+ return true;
506507}
507508
508- static void curl_async_multi_event_stop (zend_async_event_t * event )
509+ static bool curl_async_multi_event_stop (zend_async_event_t * event )
509510{
510- if (UNEXPECTED (ZEND_ASYNC_EVENT_IS_CLOSED (event ))) {
511- return ; // Event is already closed, nothing to do
512- }
511+ return true;
513512}
514513
515514static zend_string * curl_async_multi_event_info (zend_async_event_t * event )
516515{
517516 return zend_string_init ("CURL Multi Async Event" , sizeof ("CURL Multi Async Event" ) - 1 , 0 );
518517}
519518
520- static void curl_async_multi_event_dtor (zend_async_event_t * event );
519+ static bool curl_async_multi_event_dtor (zend_async_event_t * event );
521520
522521static curl_async_multi_event_t * curl_async_multi_event_ctor (php_curlm * curl_m )
523522{
@@ -561,12 +560,10 @@ static zend_always_inline bool curl_async_multi_event_init(php_curlm * curl_m)
561560 return true;
562561}
563562
564- static void curl_async_multi_event_dtor (zend_async_event_t * event )
563+ static bool curl_async_multi_event_dtor (zend_async_event_t * event )
565564{
566565 if (false == ZEND_ASYNC_EVENT_IS_CLOSED (event )) {
567- if (!event -> stop (event )) {
568- // Optimized: ignore stop failure in multi-event destructor cleanup
569- }
566+ event -> stop (event );
570567 }
571568
572569 curl_async_multi_event_t * curl_event = (curl_async_multi_event_t * ) event ;
@@ -596,6 +593,8 @@ static void curl_async_multi_event_dtor(zend_async_event_t *event)
596593 zend_async_callbacks_free (event );
597594
598595 efree (curl_event );
596+
597+ return true;
599598}
600599
601600static void multi_timer_callback (
@@ -892,4 +891,4 @@ CURLMcode curl_async_select(php_curlm * curl_m, int timeout_ms, int* numfds)
892891 zend_async_waker_clean (coroutine );
893892
894893 return result ;
895- }
894+ }
0 commit comments