|
|
|
@@ -33,3 +33,20 @@ enum Entrypoint { |
|
|
|
try await app.runFromAsyncMainEntrypoint() |
|
|
|
} |
|
|
|
} |
|
|
|
extension Application { |
|
|
|
static let entrypointQueue = DispatchQueue(label: "app.entrypoint") |
|
|
|
|
|
|
|
func runAsync() async throws { |
|
|
|
nonisolated(unsafe) let app = self |
|
|
|
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in |
|
|
|
Application.entrypointQueue.async { |
|
|
|
do { |
|
|
|
try app.run() |
|
|
|
continuation.resume() |
|
|
|
} catch { |
|
|
|
continuation.resume(throwing: error) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |