resolve: Wait until all existing futures in an environment are resolved
Description
The environment is first scanned for futures and then the futures
are polled until all are resolved. When a resolved future is
detected its value is retrieved (optionally).
This provides an efficient mechanism for waiting for a set of
futures to be resolved and in the meanwhile retrieving values
of already resolved futures.