Given a function fun which returns a promise, globally memoize it (across all threads), so that at most one invocation of fun with the given parameters is invoked during the program's lifetime. If a fun promise is in progress (incl. if started by another thread), wait for it to finish first.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Promise concurrency tools.