promiseWithLoop

fnPromise!T promiseWithLoop(T)(EventLoop * loop, CompletionPolicy policy = CompletionPolicy.DEFERRED) @trusted

Create a promise/future pair with EventLoop integration.

When policy is CompletionPolicy.DEFERRED, callbacks registered via then()/onError()/onCancel() are queued via EventLoop.defer() and execute on the next loop iteration. This prevents reentrancy and guarantees callbacks run on the loop thread.

Parameters

loopEventLoop to use for deferred completion.
policyCompletion policy (default: DEFERRED).
TThe type of value the future will hold.

Returns

A new promise with EventLoop integration.