Skip to main content

libdd_shared_runtime/
lib.rs

1// Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3#![cfg_attr(not(test), deny(clippy::panic))]
4#![cfg_attr(not(test), deny(clippy::unwrap_used))]
5#![cfg_attr(not(test), deny(clippy::expect_used))]
6#![cfg_attr(not(test), deny(clippy::todo))]
7#![cfg_attr(not(test), deny(clippy::unimplemented))]
8
9//! A shared tokio runtime for running background workers across multiple components.
10//!
11//! This crate provides [`SharedRuntime`], which owns a single tokio runtime and manages
12//! [`PausableWorker`]s on it. Components such as the trace exporter can share one runtime
13//! instead of each creating their own, reducing thread and resource overhead.
14//!
15//! [`SharedRuntime`] also provides fork-safety hooks (`before_fork`, `after_fork_parent`,
16//! `after_fork_child`) that pause and restart workers around `fork()` calls, preventing
17//! deadlocks in child processes.
18
19pub mod shared_runtime;
20pub mod worker;
21
22// Top-level re-exports for convenience
23pub use shared_runtime::{SharedRuntime, SharedRuntimeError, WorkerHandle, WorkerHandleError};
24pub use worker::Worker;