Created
January 15, 2017 07:18
-
-
Save vanhoavn/e426ffdfc3f1502084c56d9190bf5a83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// .... | |
function processCurlMulti($curl_session_multi) { | |
do { | |
$mrc = curl_multi_exec($curl_session_multi, $n_running_channel); | |
} while ($mrc == CURLM_CALL_MULTI_PERFORM || $n_running_channel > 0); | |
$n_idle = 0; | |
while ($mrc == CURLM_OK && $n_idle <= MAX_WAIT_CYCLES) { | |
if (curl_multi_select($curl_session_multi) != -1) { | |
$n_idle = 0; | |
do { | |
$mrc = curl_multi_exec($curl_session_multi, $n_running_channel); | |
} while ($mrc == CURLM_CALL_MULTI_PERFORM || $n_running_channel > 0); | |
} else { | |
$n_idle++; | |
usleep(250000); | |
} | |
} | |
return $mrc; | |
} | |
// .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment