//! # smarm — Silly Marks Abstract Rust Machine //! //! Erlang-style green-thread actor concurrency for Rust. //! //! v0.1 is single-threaded. One scheduler, one OS thread. The scheduler //! cooperatively interleaves green-thread actors with hand-rolled context //! switches. Actors communicate by sending `Send` messages over channels; //! every actor has a supervisor, which is itself just an actor with a //! `Receiver`. //! //! See `LOOM.md` for the design intent and the deferred-for-later list. pub mod stack; pub mod context; pub mod preempt; pub mod pid; pub mod actor; pub mod channel; pub mod scheduler; pub mod supervisor; pub mod timer; pub mod io; // --------------------------------------------------------------------------- // Global allocator // // The preempting allocator wraps `System`. While `PREEMPTION_ENABLED` is // false (the default outside an actor) it adds one branch per allocation // and no syscalls. The scheduler flips it on per-resume. // --------------------------------------------------------------------------- #[global_allocator] static ALLOCATOR: preempt::PreemptingAllocator = preempt::PreemptingAllocator; // --------------------------------------------------------------------------- // Public API re-exports // --------------------------------------------------------------------------- pub use channel::{channel, Receiver, RecvError, Sender}; pub use pid::Pid; pub use scheduler::{ block_on_io, run, self_pid, sleep, spawn, spawn_under, yield_now, JoinError, JoinHandle, }; pub use supervisor::Signal;