pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:47:    key = 0;    }       if (s == STATE_REJECTED) {    throw(res);    }    return res;    }       //! Register a callback that is to be called on fulfillment. -  void on_success(function(mixed, mixed ... : void) cb, mixed ... extra) +  this_program on_success(function(mixed, mixed ... : void) cb, mixed ... extra)    {    object key = mux->lock();    success_cb = cb;    success_ctx = extra;    State s = state;    mixed res = result;    key = 0;    if (s == STATE_FULFILLED) {    call_out(cb, 0, res, @extra);    } -  +  +  return this;    }       //! Register a callback that is to be called on failure. -  void on_failure(function(mixed, mixed ... : void) cb, mixed ... extra) +  this_program on_failure(function(mixed, mixed ... : void) cb, mixed ... extra)    {    object key = mux->lock();    failure_cb = cb;    failure_ctx = extra;    State s = state;    mixed res = result;    key = 0;    if (s == STATE_REJECTED) {    call_out(cb, 0, res, @extra);    } -  +  return this;    }       //! Apply @[fun] with @[val] followed by the contents of @[ctx],    //! and update @[p] with the result.    protected void apply(mixed val, Promise p,    function(mixed, mixed ... : mixed) fun,    array(mixed) ctx)    {    mixed err = catch {    p->success(fun(val, @ctx));