pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:341:    //! @[recover()], @[map_with()], @[transform_with()]    this_program recover_with(function(mixed, mixed ... : this_program) fun,    mixed ... extra)    {    Promise p = Promise();    on_success(p->success);    on_failure(apply_flat, p, fun, extra);    return p->future();    }    -  //! Return a @[Future] that either will by fulfilled by the -  //! fulfilled result of this @[Future] if applying @[fun] -  //! with the result followed by @[extra] returns true, -  //! or will fail with @[UNDEFINED] if it returns false. +  //! This specifies a callback that is only called on success, and +  //! allows you to selectively alter the future into a failure. +  //! +  //! @param fun +  //! Function to be called. The first argument will be the +  //! @b{success@} result of @b{this@} @[Future]. +  //! If the return value is @expr{true}, the future succeeds with +  //! the original success result. +  //! If the return value is @expr{false}, the future fails with +  //! an @[UNDEFINED] 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]. +  //! +  //! @seealso +  //! @[transform()]    this_program filter(function(mixed, mixed ... : int(0..1)) fun,    mixed ... extra)    {    Promise p = Promise();    on_failure(p->failure);    on_success(apply_filter, p, fun, extra);    return p->future();    }    -  //! This specifies callbacks that allows you to alter the future. +  //! This specifies callbacks that allow you to alter the future.    //!    //! @param success    //! 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 failure    //! 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].
pike.git/lib/modules/Concurrent.pmod:392:    this_program transform(function(mixed, mixed ... : mixed) success,    function(mixed, mixed ... : mixed)|void failure,    mixed ... extra)    {    Promise p = Promise();    on_success(apply, p, success, extra);    on_failure(apply, p, failure || success, extra);    return p->future();    }    -  //! This specifies callbacks that allows you to alter the future. +  //! This specifies callbacks that allow you to alter the future.    //!    //! @param success    //! 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 failure    //! Function to be called. The first argument will be the    //! @b{failure@} result of @b{this@} @[Future].