Branch: Tag:

2016-05-05

2016-05-05 06:14:37 by Pontus Östlund <poppanator@gmail.com>

Concurrent.pmod: The Result class was always stuck in a PENDING state since new copies of the result and state arrays was created in the loop in the contructor. Moved the initiation of these arrays outside of the loop.

348:    success(({}));    return;    } +  +  array(mixed) results = allocate(sizeof(futures), UNDEFINED); +  array(State) states = allocate(sizeof(futures), STATE_PENDING); +     futures->on_failure(failure); -  +     foreach(futures; int i; Future f) { -  f->on_success(got_success, i, -  allocate(sizeof(futures), UNDEFINED), -  allocate(sizeof(futures), STATE_PENDING)); +  f->on_success(got_success, i, results, states);    }    }   
363:    results[i] = value;    states[i] = STATE_FULFILLED;    if (!state) { -  if (has_value(states, STATE_PENDING)) return; +  if (has_value(states, STATE_PENDING)) { +  return;    } -  +  }    success(results);    }   }