Skip to content

Conversation

@scottmarchant
Copy link
Collaborator

@scottmarchant scottmarchant commented Dec 2, 2025

Summary

Implements AsyncEventLoop and MultiThreadedEventLoopGroup atop AsyncEventLoopExecutor for non-Posix runtimes. Umbrella: #2.

Details

  • 023e473 feat: Implement AsynceEventLoop and MultiThreadedEventLoopGroup using Swift Concurrency and the AsyncEventLoopExecutor. Forms a key foundation for several vapor repositories to use NIO without using NIOPosix. This enables a large amount of wasm compilation for packages that currently consume NIOPosix.

Usage Examples

  • Schedule work on a manual-time async event loop and advance time deterministically:
let loop = AsyncEventLoop(manualTimeModeForTesting: true)
let scheduled = loop.scheduleTask(in: .seconds(1)) { "done" }
try await loop.advanceTime(by: .seconds(1))
let value = try await scheduled.futureResult.get()  // "done"
  • Run tasks on a MultiThreadedEventLoopGroup:
let group = MultiThreadedEventLoopGroup(numberOfThreads: 2)
let loop = group.next()
let future: EventLoopFuture<String> = loop.submit { "hello" }
let value = try await future.get()
try await group.syncShutdownGracefully()

Corresponding test coverage: #6, #7, #10.

… Swift Concurrency and the AsyncEventLoopExecutor. Forms a key foundation for several vapor repositories to use NIO without using NIOPosix. This enables a large amount of wasm compilation for packages that currently consume NIOPosix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants