Rename reactor -> driver, prep for lib/reactivity
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
//! Runtime, driver, async I/O, and channel primitives for RUIN.
|
||||
//!
|
||||
//! The crate is centered around a single-threaded event loop with explicit worker threads,
|
||||
//! JavaScript-style microtask/macrotask scheduling, and Linux `io_uring`-backed I/O.
|
||||
//!
|
||||
//! Most users will start with:
|
||||
//!
|
||||
//! - [`main`] or [`async_main`] for executable entry points
|
||||
//! - [`run`], [`queue_task`], [`queue_microtask`], and [`queue_future`] for event-loop work
|
||||
//! - [`fs`], [`net`], [`time`], and [`channel`] for async runtime services
|
||||
//!
|
||||
//! # Platform support
|
||||
//!
|
||||
//! `ruin-runtime` currently targets Linux on `x86_64`.
|
||||
//!
|
||||
//! RUIN runtime foundations.
|
||||
//!
|
||||
//! This crate provides a Linux x86_64 runtime substrate: the mesh allocator, the reactor, and a
|
||||
//! This crate provides a Linux x86_64 runtime substrate: the mesh allocator, the driver, and a
|
||||
//! single-threaded runtime loop with worker-thread task forwarding.
|
||||
|
||||
#![feature(thread_local)]
|
||||
@@ -13,13 +28,31 @@ extern crate alloc;
|
||||
pub mod channel;
|
||||
pub mod fs;
|
||||
pub mod net;
|
||||
#[doc(hidden)]
|
||||
pub mod op;
|
||||
#[doc(hidden)]
|
||||
pub mod platform;
|
||||
#[doc(hidden)]
|
||||
pub mod sys;
|
||||
pub mod time;
|
||||
|
||||
pub use ruin_runtime_proc_macros::{async_main, main};
|
||||
/// Marks an `async fn main()` as the runtime entry point.
|
||||
///
|
||||
/// The macro generates a real Rust `main` that queues the returned future onto the main runtime
|
||||
/// thread before calling [`run`].
|
||||
pub use ruin_runtime_proc_macros::async_main;
|
||||
/// Marks a synchronous `fn main()` as the runtime entry point.
|
||||
///
|
||||
/// The macro generates a real Rust `main` that queues the function body onto the main runtime
|
||||
/// thread before calling [`run`].
|
||||
pub use ruin_runtime_proc_macros::main;
|
||||
|
||||
/// Driver primitives re-exported from the Linux x86_64 backend.
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub use platform::linux_x86_64::driver::{
|
||||
Driver, ReadyEvents, ThreadNotifier, create, create_driver, monotonic_now,
|
||||
};
|
||||
/// Public mesh-allocator surface re-exported from the Linux x86_64 backend.
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub use platform::linux_x86_64::mesh_alloc::{
|
||||
ActiveMeshGuard, Arena, AtomicBitmap, BitIter, CLASS_TO_SIZE, CompactionAdvice,
|
||||
@@ -32,12 +65,10 @@ pub use platform::linux_x86_64::mesh_alloc::{
|
||||
page_shift, page_size, retry_on_efault, retry_on_efault_ptrs, round_up_to_page,
|
||||
runtime_slots_per_span, size_class_for,
|
||||
};
|
||||
/// Additional allocator helpers re-exported from the Linux x86_64 backend.
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub use platform::linux_x86_64::mesh_alloc::{FreelistId, bitmaps_meshable};
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub use platform::linux_x86_64::reactor::{
|
||||
Reactor, ReadyEvents, ThreadNotifier, create, create_reactor, monotonic_now,
|
||||
};
|
||||
/// Runtime/event-loop primitives re-exported from the Linux x86_64 backend.
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub use platform::linux_x86_64::runtime::{
|
||||
IntervalHandle, JoinHandle, ThreadHandle, TimeoutHandle, WorkerHandle, clear_interval,
|
||||
@@ -45,6 +76,9 @@ pub use platform::linux_x86_64::runtime::{
|
||||
set_interval, set_timeout, spawn_worker, yield_now,
|
||||
};
|
||||
|
||||
/// Returns the default global mesh allocator configuration for this crate.
|
||||
///
|
||||
/// This is useful when embedding the allocator in a `#[global_allocator]` static.
|
||||
pub const fn default_global_allocator() -> GlobalMeshAllocator {
|
||||
GlobalMeshAllocator::with_default_config()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user