-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
268b92b
commit de6927a
Showing
5 changed files
with
98 additions
and
130 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
Sources/Hummingbird/AsyncAwaitSupport/Request+Persist+async.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Hummingbird server framework project | ||
// | ||
// Copyright (c) 2021-2021 the Hummingbird authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import ServiceLifecycle | ||
|
||
actor ShutdownWaiter { | ||
private var taskContinuation: CheckedContinuation<Void, Never>? | ||
|
||
init() {} | ||
|
||
func wait() async { | ||
await withGracefulShutdownHandler { | ||
await withCheckedContinuation { continuation in | ||
self.taskContinuation = continuation | ||
} | ||
} onGracefulShutdown: { | ||
Task { | ||
await self.stop() | ||
} | ||
} | ||
} | ||
|
||
private func stop() { | ||
self.taskContinuation?.resume() | ||
self.taskContinuation = nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters