pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:168:    (timeout_call_out_handle);    timeout_call_out_handle = UNDEFINED;    }    if (backend) {    backend->call_out(cb, 0, @args);    } else {    callout(cb, 0, @args);    }    }    -  //! Wait for fulfillment and return the value. +  //! Wait for fulfillment.    //! -  //! @throws -  //! Throws on rejection. -  mixed get() +  //! @seealso +  //! @[get()] +  this_program wait()    { -  State s = state; -  mixed res = result; -  if (!s) { +  if (state <= STATE_PENDING) {    Thread.MutexKey key = mux->lock();    while (state <= STATE_PENDING) {    cond->wait(key);    } -  +  }    -  s = state; -  res = result; +  return this;    }    -  if (s >= STATE_REJECTED) { -  throw(res); +  //! Wait for fulfillment and return the value. +  //! +  //! @throws +  //! Throws on rejection. +  //! +  //! @seealso +  //! @[wait()] +  mixed get() +  { +  wait(); +  +  if (state >= STATE_REJECTED) { +  throw(result);    } -  return res; +  return result;    }       //! Register a callback that is to be called on fulfillment.    //!    //! @param cb    //! Function to be called. The first argument will be the    //! result of the @[Future].    //!    //! @param extra    //! Any extra context needed for @[cb]. They will be provided
pike.git/lib/modules/Concurrent.pmod:844:    return ::on_success(cb, @extra);    }       Future on_failure(function(mixed, mixed ... : void) cb, mixed ... extra)    {    if (_astate)    _astate->materialise();    return ::on_failure(cb, @extra);    }    +  Future wait() +  { +  if (_astate) +  _astate->materialise(); +  return ::wait(); +  } +     mixed get()    {    if (_astate)    _astate->materialise();    return ::get();    }       //! The future value that we promise.    Future future()    {