pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:436:    return t=='O' && sprintf("%O(%s,%O)", this_program,    ([ STATE_PENDING : "pending",    STATE_REJECTED : "rejected",    STATE_FULFILLED : "fulfilled" ])[state],    result);    }   }      class aggregate_state {    private Promise promise; -  final int(0..) promises; -  final array(mixed) results; +  private int(0..) promises;    private int(0..) succeeded, failed; -  +  final array(mixed) results;    final int(0..) min_failed;    final int(-1..) max_failed;    final mixed accumulator;    final function(mixed, mixed, mixed ... : mixed) fold_fun;    final array(mixed) extra;       private void create(Promise p) {    if (p->_materialised || p->_materialised++)    error("Cannot materialise a Promise more than once.\n");    promise = p;
pike.git/lib/modules/Concurrent.pmod:474:    }    }    }    key = 0;    }       private void fold_one(mixed val) {    mixed err = catch (accumulator = fold_fun(val, accumulator, @extra));    if (err) {    Promise p = promise; // Cache it, to cover a failure race -  p && p->failure(err); +  if (p) p->failure(err);    }    }       private void fold(function(mixed:void) failsucc) { -  if (fold_fun) -  failsucc(accumulator); -  else -  failsucc(results); +  failsucc(fold_fun ? accumulator : results);    results = 0;    }       private void cb_failure(mixed value, int idx) {    Promise p; // Cache it, to cover a failure race    if (p = promise) {    object key = mux->lock();    do {    if (!p->state) {    ++failed;