windows-threadpool-sys 0.2.1

Memory-safe access to the Windows thread pool APIs.
Documentation
# Copyright (c) 2026 Mike Grier

[package]
name = "windows-threadpool-sys"
version = "0.2.1" # x-release-please-version
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/windows-threadpool-sys"
readme = "README.md"
description = "Memory-safe access to the Windows thread pool APIs."
keywords = ["windows", "threadpool", "asynchronous", "ffi"]
categories = ["api-bindings", "os::windows-apis"]

[lib]
path = "src/lib.rs"

# The crate is Windows-only, so docs.rs must build it on a Windows target or it
# would fail to compile the thread-pool bindings entirely.
[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
targets = ["x86_64-pc-windows-msvc"]

[dependencies]
# The shared overlapped-I/O foundation: owned endpoints, pinned operations, and the
# submission seam (`into_overlapped` / `from_overlapped` / `reclaim_overlapped`) that
# the `TP_IO` backend builds on. Published independently, so both a path (for the
# workspace) and a version (for consumers building from crates.io) are required. No
# features are enabled (`default-features = false`): the `TP_IO` backend needs only
# the core completion machinery, not any operation-family adapter (fs, socket, device).
windows-overlapped-io-sys = { version = "0.2.0", path = "../windows-overlapped-io-sys", default-features = false }
# Events: `WaitableHandle::event` creates through it, and `From<Event>` converts one into a
# wait target. The crate makes no event of its own (WS-D-5 in win-sync-sys' DESIGN-NOTES.md).
# Published independently, so both a path and a version.
win-sync-sys = { version = "0.0.2", path = "../win-sync-sys" }
# Interrupt time, which the self-heal stamps a cancellation and its repair with: the workspace reads
# its one time base through this crate rather than each crate calling `QueryInterruptTime` itself
# (WT-D-1 in win-time-sys' DESIGN-NOTES.md). Optional, pulled in by `self-heal` alone. Published
# independently, so both a path and a version.
win-time-sys = { version = "0.1.0", path = "../win-time-sys", optional = true }

[features]
default = ["self-heal"]

# Turns the undischarged-obligation report at `Drop` into a panic, making these
# types linear rather than affine: a caller who leaves the blocking drain to
# `Drop` fails instead of being told about it.
#
# OFF by default, and enabling it arms the fail-fast directly. Cargo features
# are additive and unified, so any crate in a build that enables this changes
# teardown behaviour for EVERY crate in that build -- including code that never
# called this API, and whose author cannot see the manifest that enabled it. A
# consumer cannot decline it either: `default-features = false` governs one
# dependency edge, not the union. Enabling it is therefore a decision for a
# top-level binary configuring its own test or CI build; a library enabling it
# is the misuse. See DESIGN-NOTES.md.
fail-fast = []

# Repairs a pool that a cancellation may have left unable to make its first
# worker, by submitting a work item to it -- the one action measured to release
# that stall every time. On by default, and the reason `try_cancel_pending` can
# be a safe method at all: see README-FEATURE-self-heal.md for what it costs and
# what to watch for if you turn it off.
#
# Turning it off removes `try_cancel_pending` rather than changing what it
# means, so a consumer who relied on it gets a compile error naming the
# `unsafe` sibling to reach for instead.
# `win-time-sys` is for interrupt time, which stamps a cancellation and the
# repair lifecycle so the self-heal can tell a pool whose repair has dispatched
# from one whose has not. Ordinary callbacks do not touch it: see the cost table
# in README-FEATURE-self-heal.md. Pulled in only with this feature, so a
# consumer who turns self-heal off never compiles it.
self-heal = ["dep:win-time-sys"]

# A trace for defects that only appear under concurrency. Off by default and
# absent from the compiled output when off, because the instrument for that
# class of problem must not change the schedule it is measuring.
#
# It pulls two extra `windows-sys` features in with it, for the vectored
# exception handler the trace installs when it is switched on at run time.
# `AddVectoredExceptionHandler` and `EXCEPTION_POINTERS` are both gated on
# `Win32_System_Kernel` as well as on the `Debug` module they live in. Both are
# enabled only with this feature, so a consumer who never traces never
# compiles them.
trace = [
	"windows-sys/Win32_System_Diagnostics_Debug",
	"windows-sys/Win32_System_Kernel",
]
[dependencies.windows-sys]
version = "0.61.2"
default-features = false
features = [
	"Win32_Foundation",
	"Win32_System_IO",
	"Win32_System_Threading",
]

# The TP_IO tests issue real overlapped I/O against a named pipe, which needs
# binding surface the published crate itself does not use.
[dev-dependencies.windows-sys]
version = "0.61.2"
default-features = false
features = [
	"Win32_Foundation",
	"Win32_System_IO",
	"Win32_System_Threading",
	"Win32_Security",
	"Win32_Storage_FileSystem",
	"Win32_System_Pipes",
]