Branch: Tag:

2016-05-31

2016-05-31 16:06:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Concurrent.Promise: Added unlocked variants of success() and failure().

266:    return Future::this;    }    -  //! Fulfill the @[Future] value. -  void success(mixed value) +  protected void unlocked_success(mixed value)    { -  object key = mux->lock(); +     if (state < STATE_REJECTED) {    result = value;    state = STATE_FULFILLED;    function cb = success_cb;    array(mixed) extra = success_ctx;    cond->broadcast(); -  key = 0; +     if (cb) {    call_out(cb, 0, value, @extra);    }    }    }    -  //! Reject the @[Future] value. -  void failure(mixed value) +  //! Fulfill the @[Future] value. +  void success(mixed value)    {    object key = mux->lock(); -  +  unlocked_success(value); +  key = 0; +  } +  +  protected void unlocked_failure(mixed value) +  {    state = STATE_REJECTED;    result = value;    function cb = failure_cb;    array(mixed) extra = failure_ctx;    cond->broadcast(); -  key = 0; +     if (cb) {    call_out(cb, 0, value, @extra);    }    }    -  +  //! Reject the @[Future] value. +  void failure(mixed value) +  { +  object key = mux->lock(); +  unlocked_failure(value); +  key = 0; +  } +     protected void destroy()    {    if (!state) {