pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:208:    if (fun(val, @ctx)) {    p->success(val);    } else {    p->failure(UNDEFINED);    }    return;    };    p->failure(err);    }    -  //! Return a @[Future] that will be fulfilled with the result -  //! of applying @[fun] with the fulfilled result of this @[Future] -  //! followed by @[extra]. +  //! This specifies a callback that is only called on success, and +  //! allows you to alter the future.    //! -  +  //! @param fun +  //! Function to be called. The first argument will be the +  //! @b{success@} result of @b{this@} @[Future]. +  //! The return value will be the success result of the new @[Future]. +  //! +  //! @param extra +  //! Any extra context needed for +  //! @expr{fun@}. They will be provided +  //! as arguments two and onwards when the callback is called. +  //! +  //! @returns +  //! The new @[Future]. +  //!    //! @note    //! This method is used if your @[fun] returns a regular value (i.e.    //! @b{not@} a @[Future]).    //!    //! @seealso    //! @[map_with()], @[transform()], @[recover()]    this_program map(function(mixed, mixed ... : mixed) fun, mixed ... extra)    {    Promise p = Promise();    on_failure(p->failure);    on_success(apply, p, fun, extra);    return p->future();    }    -  //! Return a @[Future] that will be fulfilled with the fulfilled result -  //! of applying @[fun] with the fulfilled result of this @[Future] -  //! followed by @[extra]. +  //! This specifies a callback that is only called on success, and +  //! allows you to alter the future.    //! -  +  //! @param fun +  //! Function to be called. The first argument will be the +  //! @b{success@} result of @b{this@} @[Future]. +  //! The return value must be a @[Future] that promises +  //! the new result. +  //! +  //! @param extra +  //! Any extra context needed for +  //! @expr{fun@}. They will be provided +  //! as arguments two and onwards when the callback is called. +  //! +  //! @returns +  //! The new @[Future]. +  //!    //! @note    //! This method is used if your @[fun] returns a @[Future] again.    //!    //! @seealso    //! @[map()], @[transform_with()], @[recover_with()], @[flat_map]    this_program map_with(function(mixed, mixed ... : this_program) fun,    mixed ... extra)    {    Promise p = Promise();    on_failure(p->failure);
pike.git/lib/modules/Concurrent.pmod:254:    //! This is an alias for @[map_with()].    //!    //! @seealso    //! @[map_with()]    inline this_program flat_map(function(mixed, mixed ... : this_program) fun,    mixed ... extra)    {    return map_with(fun, @extra);    }    -  //! Return a @[Future] that will be fulfilled with either -  //! the fulfilled result of this @[Future], or the result -  //! of applying @[fun] with the failed result followed -  //! by @[extra]. +  //! This specifies a callback that is only called on failure, and +  //! allows you to alter the future into a success.    //! -  +  //! @param fun +  //! Function to be called. The first argument will be the +  //! @b{failure@} result of @b{this@} @[Future]. +  //! The return value will be the success result of the new @[Future]. +  //! +  //! @param extra +  //! Any extra context needed for +  //! @expr{fun@}. They will be provided +  //! as arguments two and onwards when the callback is called. +  //! +  //! @returns +  //! The new @[Future]. +  //!    //! @note    //! This method is used if your callbacks returns a regular value (i.e.    //! @b{not@} a @[Future]).    //!    //! @seealso    //! @[recover_with()], @[map()], @[transform()]    this_program recover(function(mixed, mixed ... : mixed) fun,    mixed ... extra)    {    Promise p = Promise();    on_success(p->success);    on_failure(apply, p, fun, extra);    return p->future();    }    -  //! Return a @[Future] that will be fulfilled with either -  //! the fulfilled result of this @[Future], or the fulfilled result -  //! of applying @[fun] with the failed result followed -  //! by @[extra]. +  //! This specifies a callback that is only called on failure, and +  //! allows you to alter the future into a success.    //! -  +  //! @param fun +  //! Function to be called. The first argument will be the +  //! @b{failure@} result of @b{this@} @[Future]. +  //! The return value must be a @[Future] that promises +  //! the new success result. +  //! +  //! @param extra +  //! Any extra context needed for +  //! @expr{fun@}. They will be provided +  //! as arguments two and onwards when the callback is called. +  //! +  //! @returns +  //! The new @[Future]. +  //!    //! @note    //! This method is used if your callbacks returns a @[Future] again.    //!    //! @seealso    //! @[recover()], @[map_with()], @[transform_with()]    this_program recover_with(function(mixed, mixed ... : this_program) fun,    mixed ... extra)    {    Promise p = Promise();    on_success(p->success);