pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:386:   //! code that provides the @[Future] value. The only thing   //! that is directly returned to the user is the return   //! value from @[future()].   //!   //! @seealso   //! @[Future], @[future()]   class Promise   {    inherit Future;    +  //! Creates a new promise, optionally initialised from a traditional callback +  //! driven method via @expr{executor(resolve, reject, extra ... )@}. +  //! +  //! @seealso +  //! @url{https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise@} +  protected void create(void| +  function(function(mixed:void), +  function(mixed:void), mixed ...:void) executor, mixed ... extra) { +  if (executor) +  executor(success, failure, @extra); +  } +     //! The future value that we promise.    Future future()    {    return Future::this;    }       protected void unlocked_success(mixed value)    {    if (state < STATE_REJECTED) {    result = value;