
Aggregates platform-specific system signals into a unified API, offering idiomatic language features, zero external dependencies, and extensive platform support for handling, awaiting, and raising signals.
A Kotlin Multiplatform library that aggregates platform specific system signals (e.g. SIGINT, SIGTERM, etc.) into a clean common API.
Currently ksignal supports the following targets:
jvmlinuxX64linuxArm64mingwX64androidNativeX64androidNativeArm64androidNativeX86androidNativeArm32macosX64macosArm64iosX64iosArm64iosSimulatorArm64watchosX64watchosArm64watchosSimulatorArm64watchosDeviceArm64watchosArm32tvosX64tvosArm64tvosSimulatorArm64The ksignal dependency is available on Maven Central and can be added to your common source set.
Just replace $ksignalVersion with the latest version.
implementation("de.jonasbroeckmann.ksignal:ksignal:$ksignalVersion")implementation "de.jonasbroeckmann.ksignal:ksignal:$ksignalVersion"<dependencies>
<dependency>
<groupId>de.jonasbroeckmann.ksignal</groupId>
<artifactId>ksignal</artifactId>
<version>$ksignalVersion</version>
</dependency>
</dependencies>Signal.ABRT.handle { println("Received abort") } // Returns the previous handlerSignal.INT.withHandler(
Signal.Handler { println("Received interrupt") }
) {
// Do some stuff that might be interrupted
}
// The previous handler is restored after the blockSignal.TERM.await() // Suspends until the signal is raisedSignal.SEGV.raise()If you have any feedback or ideas, feel free to open an issue or create a pull request.
This project is licensed under the MIT License.
A Kotlin Multiplatform library that aggregates platform specific system signals (e.g. SIGINT, SIGTERM, etc.) into a clean common API.
Currently ksignal supports the following targets:
jvmlinuxX64linuxArm64mingwX64androidNativeX64androidNativeArm64androidNativeX86androidNativeArm32macosX64macosArm64iosX64iosArm64iosSimulatorArm64watchosX64watchosArm64watchosSimulatorArm64watchosDeviceArm64watchosArm32tvosX64tvosArm64tvosSimulatorArm64The ksignal dependency is available on Maven Central and can be added to your common source set.
Just replace $ksignalVersion with the latest version.
implementation("de.jonasbroeckmann.ksignal:ksignal:$ksignalVersion")implementation "de.jonasbroeckmann.ksignal:ksignal:$ksignalVersion"<dependencies>
<dependency>
<groupId>de.jonasbroeckmann.ksignal</groupId>
<artifactId>ksignal</artifactId>
<version>$ksignalVersion</version>
</dependency>
</dependencies>Signal.ABRT.handle { println("Received abort") } // Returns the previous handlerSignal.INT.withHandler(
Signal.Handler { println("Received interrupt") }
) {
// Do some stuff that might be interrupted
}
// The previous handler is restored after the blockSignal.TERM.await() // Suspends until the signal is raisedSignal.SEGV.raise()If you have any feedback or ideas, feel free to open an issue or create a pull request.
This project is licensed under the MIT License.