Multiple callbacks for Concurrent.Future

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7816

Reported by Martin Karlgren marty@roxen.com

It seems Concurrent.Future only supports one callback at a time. This can lead to unexpected effects, because earlier set callbacks are silently cleared when a new one is set.

Concurrent.Future fut1 = ...
Concurrent.Future fut2 = future->flat_map(function1);
Concurrent.Future fut3 = future->flat_map(function2);

Only fut3 will yield a result because the callback used by the flat_map for fut2 is cleared.

It should be possible to store the callbacks in an array instead, right?