Branch: Tag:

2018-04-09

2018-04-09 21:54:02 by Martin Karlgren <marty@roxen.com>

Concurrent.results: Handle an empty argument array properly.

Previously code such as:

Concurrent.Future f2 = Concurrent.results(({}));

f2->on_success(lambda(array(string) a) { werror("success: %O.\n", a); })
->on_failure(lambda(mixed err) { werror (describe_backtrace(err)); });

... would lead to a backtrace because the future was destructed prematurely.

379:   test_do([[ add_constant("p13"); ]])   exit_promise(1, ({11, 14, 12, 13}))    + dnl - Concurrent.results() - empty + init_promise() + test_do([[ add_constant("future", Concurrent.results(({}))); ]]) + init_future() + exit_promise(1, ({})) +    dnl - Concurrent.traverse()   init_promise()   test_do([[ add_constant("p11", Concurrent.Promise()); ]])