Meta Engineer?

This is available as Async\Semaphore in the www repository.

Run an operation with a limit on number of ongoing asynchronous jobs

All operations must have the same input type (Tin) and output type (Tout), and be processed by the same function; Tin may be a callable invoked by the function for maximum flexibility, however this pattern is best avoided in favor of creating semaphores with a more narrow process.

Use genWaitFor() to retrieve a Tout from a Tin.

Interface Synopsis

namespace HH\Lib\Async;

final class Semaphore {...}

Public Methods