pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:67:   }      private void auto_use_backend()   {    callout = call_out;   }      protected function(function(mixed ...:void), int|float, mixed ...:mixed)    callout = ((callout = callnow), call_out(auto_use_backend, 0), callout);    + private int allzero(mixed x) + { +  return 0; + } +    //! Value that will be provided asynchronously   //! sometime in the future.   //!   //! @seealso   //! @[Promise]   class Future   {    mixed result;    State state;   
pike.git/lib/modules/Concurrent.pmod:922:    //! Mark the @[Future] as fulfilled, and schedule the @[on_success()]    //! callbacks to be called as soon as possible.    //!    //! @seealso    //! @[try_success()], @[try_failure()], @[failure()], @[on_success()]    this_program success(mixed value, void|int try)    {    return finalise(STATE_FULFILLED, value, try, success_cbs);    }    +  //! Return a @[Future] that will be fulfilled with the fulfilled +  //! result of this @[Future], but not until at least @[seconds] have passed. +  this_program delay(int|float seconds) +  { +  Promise p = promise_factory(); +  on_failure(p->try_failure); +  return depend( ({ p->timeout(seconds)->recover(allzero) }) ); +  } +     //! Fulfill the @[Future] if it hasn't been fulfilled or failed already.    //!    //! @param value    //! Result of the @[Future].    //!    //! Mark the @[Future] as fulfilled if it hasn't already been fulfilled    //! or failed, and in that case schedule the @[on_success()] callbacks    //! to be called as soon as possible.    //!    //! @seealso