promiseWithLoop
fn
Promise!T promiseWithLoop(T)(EventLoop * loop, CompletionPolicy policy = CompletionPolicy.DEFERRED) @trustedCreate 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
loop | EventLoop to use for deferred completion. |
policy | Completion policy (default: DEFERRED). |
T | The type of value the future will hold. |
Returns
A new promise with EventLoop integration.