Files
Pumpkin/Cargo.toml
lokka30 1c048a17cc Implement cross platform signal handling with tokio (#183)
* ctrlc: also handle `sigterm` and `sighup` via `termination` feature

This commit enables the `termination` feature in `ctrlc` so that
`sigterm` and `sighup` are also handled on UNIX systems. This in turn
improves Docker compatibility since containers now listen to the
`SIGTERM` signal it sends to containers when trying to stop the
container via `Ctrl-C` whilst attached.

* Replace `ctrlc` signal handling with `tokio`

This removes the `ctrlc` crate from the project, replacing (and upgrading) its functionality to also handle `sigterm` and `sighup`.

Sigterm handling is working on UNIX with this commit, I haven't tested Windows compatibility with `Ctrl-C` nor have I tested `sighup` or `sigint`.

Of course, compiles and runs on UNIX. Haven't tested Windows.

* fix: remove unused import; collapse if statement

* main: fix per-os signal handling

Will only compile Windows-specific/Unix-specific code when on their respective environments.

Handles signals in a separate tokio thread so it doesn't suspend the main thread.

Tested to work on UNIX (macOS) but not tested on Windows.

* main: cargo fmt

* main: fix setup_sighandler fn signature on windows

* main: attempt 2 at fixing windows sighandler

* main: enable ctrlc for all non-unix systems

Previously, ctrlc usage in tokio was only enabled on Windows systems
(since UNIX systems have their own signal handling in Pumpkin). Instead
of limiting ctrlc to just Windows, we can make it run on any non-UNIX
system since it should be platform independent anyhow.
2024-10-27 16:29:59 +01:00

50 lines
940 B
TOML

[workspace]
resolver = "2"
members = [
"pumpkin-config",
"pumpkin-core",
"pumpkin-entity",
"pumpkin-inventory",
"pumpkin-macros/",
"pumpkin-protocol/",
"pumpkin-registry/",
"pumpkin-world",
"pumpkin/",
]
[workspace.package]
version = "0.1.0"
edition = "2021"
[profile.release]
lto = true
codegen-units = 1
[workspace.dependencies]
log = "0.4"
tokio = { version = "1.41", features = [
"fs",
"io-util",
"macros",
"net",
"rt-multi-thread",
"sync",
"io-std",
"signal",
] }
thiserror = "1.0"
num-traits = "0.2"
num-derive = "0.4"
# Concurrency/Parallelism and Synchronization
rayon = "1.10.0"
parking_lot = { version = "0.12.3", features = ["send_guard"] }
crossbeam = "0.8.4"
uuid = { version = "1.11.0", features = ["serde", "v3", "v4"] }
derive_more = { version = "1.0.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
itertools = "0.13.0"