[sr-dev] [Async] async_sleep does not work insido a while block

Iñaki Baz Castillo ibc at aliax.net
Thu Aug 4 13:10:12 CEST 2011


  $avp(async_attemps) = 1;

  while($avp(async_attemps) < 4)
  {
    xlog("L_INFO", "------------- attemp $avp(async_attemps)\n");
    $avp(async_attemps) = $avp(async_attemps) + 1;
    async_sleep("1");
    xlog("L_INFO", "something\n");
  }

  xlog("L_INFO", "*** out of the while\n");


produces:

  INFO: <script>: ------------- attemp 1
  INFO: <script>: something
  INFO: <script>: *** out of the while


So, can async_sleep() be called within a while() block? IMHO it seems
that the internal while counter lives in the initial process handling
the request so when the processing is taken by other process (after
async_sleep) it knows nothing about the while.

Thanks.


-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-dev mailing list