initial macos porting work
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! 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.
|
||||
//! JavaScript-style microtask/macrotask scheduling and platform-specific async I/O backends.
|
||||
//!
|
||||
//! Most users will start with:
|
||||
//!
|
||||
@@ -11,17 +11,22 @@
|
||||
//!
|
||||
//! # Platform support
|
||||
//!
|
||||
//! `ruin-runtime` currently targets Linux on `x86_64`.
|
||||
//! `ruin-runtime` currently targets:
|
||||
//! - Linux `x86_64`
|
||||
//! - macOS `aarch64`
|
||||
//!
|
||||
//! RUIN runtime foundations.
|
||||
//!
|
||||
//! 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.
|
||||
//! This crate provides a platform runtime substrate with a single-threaded runtime loop and
|
||||
//! worker-thread task forwarding.
|
||||
|
||||
#![feature(thread_local)]
|
||||
|
||||
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
|
||||
compile_error!("ruin-runtime currently supports only Linux x86_64.");
|
||||
#[cfg(not(any(
|
||||
all(target_os = "linux", target_arch = "x86_64"),
|
||||
all(target_os = "macos", target_arch = "aarch64")
|
||||
)))]
|
||||
compile_error!("ruin-runtime currently supports Linux x86_64 and macOS aarch64.");
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
@@ -56,11 +61,24 @@ pub use ruin_runtime_proc_macros::async_main;
|
||||
/// 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 primitives re-exported from the active backend.
|
||||
#[cfg(any(
|
||||
all(target_os = "linux", target_arch = "x86_64"),
|
||||
all(target_os = "macos", target_arch = "aarch64")
|
||||
))]
|
||||
pub use platform::current::driver::{
|
||||
Driver, ReadyEvents, ThreadNotifier, create, create_driver, monotonic_now,
|
||||
};
|
||||
/// Runtime/event-loop primitives re-exported from the active backend.
|
||||
#[cfg(any(
|
||||
all(target_os = "linux", target_arch = "x86_64"),
|
||||
all(target_os = "macos", target_arch = "aarch64")
|
||||
))]
|
||||
pub use platform::current::runtime::{
|
||||
IntervalHandle, JoinHandle, ThreadHandle, TimeoutHandle, WorkerHandle, clear_interval,
|
||||
clear_timeout, current_thread_handle, queue_future, queue_microtask, queue_task, run,
|
||||
set_interval, set_timeout, spawn_worker, yield_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::{
|
||||
@@ -77,22 +95,17 @@ pub use platform::linux_x86_64::mesh_alloc::{
|
||||
/// 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};
|
||||
/// 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,
|
||||
clear_timeout, current_thread_handle, queue_future, queue_microtask, queue_task, run,
|
||||
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.
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub const fn default_global_allocator() -> GlobalMeshAllocator {
|
||||
GlobalMeshAllocator::with_default_config()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
mod tests {
|
||||
use super::{MeshAllocator, page_size};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user