Branch: Tag:

2019-04-10

2019-04-10 09:47:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Concurrent.Future: Events may still occur after the timeout.

Fixes spurious complaint "Promise has already been finalised."
when a promise with a timeout is fullfilled after the timeout
has triggered.

Fixes PIKE-177 (#8177).

666:    this_program timeout(int|float seconds)    {    Promise p = promise_factory(); -  on_failure(p->failure); -  on_success(p->success); +  /* NB: try_* variants as the original promise may get fulfilled +  * after the timeout has occurred. +  */ +  on_failure(p->try_failure); +  on_success(p->try_success);    if (timeout_call_out_handle) {    // Remove the previous timeout call_out.    (backend?backend->remove_call_out:remove_call_out)