2015-04-16 20:06:57 +08:00
|
|
|
// This file is part of libfringe, a low-level green threading library.
|
2016-03-22 15:25:23 +08:00
|
|
|
// Copyright (c) edef <edef@edef.eu>
|
2015-04-16 18:08:44 +08:00
|
|
|
// See the LICENSE file included in this distribution.
|
2016-03-16 07:14:09 +08:00
|
|
|
#![feature(asm)]
|
2016-07-18 05:42:45 +08:00
|
|
|
#![cfg_attr(target_arch = "x86", feature(naked_functions, core_intrinsics))]
|
|
|
|
#![cfg_attr(target_arch = "x86_64", feature(naked_functions, core_intrinsics))]
|
2014-12-24 14:28:21 +08:00
|
|
|
#![no_std]
|
|
|
|
|
2016-07-17 11:11:33 +08:00
|
|
|
//! libfringe is a library implementing lightweight context switches,
|
|
|
|
//! without relying on kernel services. It can be used in hosted environments
|
|
|
|
//! (using `std`) as well as on bare metal (using `core`).
|
|
|
|
//!
|
|
|
|
//! It provides high-level, safe abstractions:
|
|
|
|
//!
|
|
|
|
//! * an implementation of internal iterators, also known as generators,
|
|
|
|
//! [Generator](generator/struct.Generator.html).
|
|
|
|
//!
|
|
|
|
//! It also provides low-level, *very* unsafe building blocks:
|
|
|
|
//!
|
|
|
|
//! * a flexible, low-level context-swapping mechanism,
|
|
|
|
//! [Context](struct.Context.html);
|
|
|
|
//! * a trait that can be implemented by stack allocators,
|
|
|
|
//! [Stack](struct.Stack.html);
|
|
|
|
//! * a stack allocator based on anonymous memory mappings with guard pages,
|
|
|
|
//! [OsStack](struct.OsStack.html).
|
|
|
|
//!
|
|
|
|
//! **FIXME:** not actually safe yet in presence of unwinding
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate std;
|
2015-04-16 22:12:26 +08:00
|
|
|
|
2015-04-16 19:39:28 +08:00
|
|
|
pub use stack::Stack;
|
2016-07-17 11:45:50 +08:00
|
|
|
pub use stack::GuardedStack;
|
2016-07-17 11:11:33 +08:00
|
|
|
pub use context::Context;
|
|
|
|
pub use generator::Generator;
|
2015-04-16 19:45:14 +08:00
|
|
|
|
2016-07-16 09:22:41 +08:00
|
|
|
#[cfg(any(unix, windows))]
|
2015-04-16 19:44:07 +08:00
|
|
|
pub use os::Stack as OsStack;
|
2014-12-23 11:24:40 +08:00
|
|
|
|
2016-07-17 11:11:33 +08:00
|
|
|
mod arch;
|
|
|
|
mod debug;
|
|
|
|
|
2015-04-16 19:25:05 +08:00
|
|
|
mod stack;
|
2016-07-17 11:11:33 +08:00
|
|
|
mod context;
|
|
|
|
pub mod generator;
|
2015-04-16 14:30:10 +08:00
|
|
|
|
2016-07-16 09:22:41 +08:00
|
|
|
#[cfg(any(unix, windows))]
|
2015-04-16 19:45:14 +08:00
|
|
|
mod os;
|