10 Commits
Author SHA1 Message Date
Franz BuschandJoannis Orlandos 1de37290c0 Enable 6.2 CI and enable Windows CI (#215)
Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
2025-11-03 19:57:02 +01:00
Franz Busch 7bef63b292 Add support for SIGPIPE (#214)
This PR adds `SIGPIPE` to the `UnixSignals`
2025-09-22 12:34:20 +02:00
Joannis Orlandos e2b442cc73 Import the Android module if available, since glibc and musl are unavailable on Android (#198)
I don't expect us to run CI against this until that's more formally
supported, but this would greatly help adoption of server-focused
packages on Android
2025-02-17 07:52:11 +00:00
Juri Pakaste a6a4bc71cc UnixSignal: Add SIGCONT (#192)
I'm using swift-service-lifecycle's UnixSignal in a text UI library, and
needed SIGCONT. It's probably not super relevant in the service use
case, but it looks like UnixSignal is the best way to handle signals,
service or not, and I don't know if there's a downside to the library
supporting it?
2024-12-10 10:07:22 +00:00
Franz Busch f70b838872 [CI] Adopt GitHub actions (#187)
# Motivation

We want to switch our CI to GitHub actions.

# Modification

This PR sets up the reusable workflows from NIO.

# Result

More modern CI.
2024-10-31 12:17:45 +01:00
Zack Zatkin-Gold d58e6bf2b1 add support for trapping sigabrt, sigill, sigsegv (#184)
- sigabrt: usually generated by the abort() function. Useful for cleanup prior to termination.
- sigill: issued if the user attempts to execute an illegal, malformed, or privileged instruction.
- sigsegv: issued if the user makes an invalid memory reference, such as dereferencing a null or invalid pointer.
2024-06-03 07:11:49 -07:00
Si Beaumont 12a031bcc1 Support compiling against Musl (#182) 2024-05-08 09:08:21 -07:00
Franz Busch b71a961c12 Add support for SIGWINCH (#161)
# Motivation
`SIGWINCH` is sent to applications when the window resizes. This is useful to observe for terminal applications to reformat the logging one resize.

# Modification
This PR adds support for `SIGWINCH` in `UnixSignal`s.
2023-10-10 19:31:12 +01:00
Franz Busch 36f71f61d7 Add support for SIGQUIT (#146)
# Motivation
Some applications want to react to `SIGQUIT` which is similar to `SIGINT` but normally maps to a different key `C-\`.

# Modification
This PR adds support for `SIGQUIT` in the `UnixSignal`s module.

# Result
Support for `SIGQUIT`.
2023-08-14 11:18:31 +01:00
Franz Busch fafab8f7ad Overhaul service lifecycle for Structured Concurrency (#130)
* Overhaul service lifecycle for Structured Concurrency

# Motivation
Since the release of Swift Concurrency the server ecosystem has adopted `async`/`await` in a lot of APIs making the user experience amazing. Another thing that Swift Concurrency introduced is Structured Concurrency which allows to create a task tree that with parent to child relations. Structured Concurrency has many benefits such as automatic cancellation and task local propagation.
The current state of this library predates the introduction of Swift Concurrency and is not inline anymore with how applications are structured that want to leverage Concurrency.

# Modification
This PR overhauls the implementation of service lifecycle completely. The reason for this is that the current implementation is very focused on how NIO based applications work before the introduction of Concurrency. Furthermore, Structured Concurrency is actually replacing part of the current functionality by providing new scoping mechanisms.
The overhauled implementation provides two primitive types. Anew `Service` protocol and a `ServiceRunner`. The former is providing a clear API which services have to conform to so that they can be run by the `ServiceRunner`.

An example usage of the types looks like this

```swift
actor FooService: Service {
    func run() async throws {}

    func shutdownGracefully() async throws {}
}
actor BarService: Service {
    func run() async throws {}

    func shutdownGracefully() async throws {}
}

let fooService = FooService()
let barService = BarService()

let runner = ServiceRunner(
    services: [fooService, barService],
   configuration: .init(),
   logger: logger
)

try await runner.run()
```

# Result
We now have a service lifecycle library that integrates nicely with Structured Concurrency. Its value add is that it solves to complex setup of the task group with the signal handling. Furthermore, it provides a currency type `Service` that can be passed to inject services.

* Remove `shutdownGracefully` method and switch to a handler based approach.

* Code review from George

* Add extensions to `TaskGroup` and `ThrowingTaskGroup`

* Remove long running property

* Documentation

* Fix tests

* Ensure ordering of shutdown

* Test

# Motivation

# Modification

# Result

* Introduce ServiceLifecycleTestKit

* Add AsyncCancelOngracefulShutdownSequence

* Tests and docs for graceful shutdown

# Motivation

# Modification

# Result

* Remove unsafe flags

* Add article for application authors

* Add correct licence and notice information for the things we copied from swift-nio

* Code review

* Remove @_unsafeInheritExectuor

* Code review

* Change log levels, rename to withGracefulShutdownHandler and support nested service runner graceful shutdown

* Add public `shutdownGracefully` method to the service runner

* Code review and expose new cancelOnGracefulShutdown method

* Extend graceful shutdown APIs and tolerate running outside of a `ServiceRunner`

* Rename to `ServiceGroup`

* Enable Swift 5.6 support

* Update soundess dockerfile

* Update Readme

* Make 5.6 build work
2023-04-27 11:56:08 +01:00