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>
|
2016-08-21 05:45:01 +08:00
|
|
|
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
|
|
|
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
|
|
|
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
|
|
|
// copied, modified, or distributed except according to those terms.
|
2016-09-01 06:04:35 +08:00
|
|
|
#![feature(asm, naked_functions, cfg_target_vendor)]
|
2016-08-19 21:58:45 +08:00
|
|
|
#![cfg_attr(feature = "alloc", feature(alloc))]
|
2016-08-09 22:08:51 +08:00
|
|
|
#![cfg_attr(test, feature(test, thread_local, const_fn))]
|
2014-12-24 14:28:21 +08:00
|
|
|
#![no_std]
|
|
|
|
|
2016-08-11 12:05:36 +08:00
|
|
|
//! libfringe is a library implementing safe, lightweight context switches,
|
2016-07-17 11:11:33 +08:00
|
|
|
//! without relying on kernel services. It can be used in hosted environments
|
|
|
|
//! (using `std`) as well as on bare metal (using `core`).
|
|
|
|
//!
|
2016-08-11 12:05:36 +08:00
|
|
|
//! It provides the following safe abstractions:
|
2016-07-17 11:11:33 +08:00
|
|
|
//!
|
2016-08-12 05:04:40 +08:00
|
|
|
//! * an implementation of generators,
|
2016-07-17 11:11:33 +08:00
|
|
|
//! [Generator](generator/struct.Generator.html).
|
|
|
|
//!
|
2016-08-11 12:05:36 +08:00
|
|
|
//! It also provides the necessary low-level building blocks:
|
2016-07-17 11:11:33 +08:00
|
|
|
//!
|
|
|
|
//! * a trait that can be implemented by stack allocators,
|
|
|
|
//! [Stack](struct.Stack.html);
|
2016-08-19 21:58:45 +08:00
|
|
|
//! * a wrapper for using slice references as stacks,
|
|
|
|
//! [SliceStack](struct.SliceStack.html);
|
|
|
|
//! * a stack allocator based on `Box<[u8]>`,
|
|
|
|
//! [OwnedStack](struct.OwnedStack.html);
|
2016-07-17 11:11:33 +08:00
|
|
|
//! * a stack allocator based on anonymous memory mappings with guard pages,
|
|
|
|
//! [OsStack](struct.OsStack.html).
|
|
|
|
|
|
|
|
#[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-08-19 21:58:45 +08:00
|
|
|
pub use slice_stack::SliceStack;
|
2016-07-17 11:11:33 +08:00
|
|
|
pub use generator::Generator;
|
2015-04-16 19:45:14 +08:00
|
|
|
|
2016-08-19 21:58:45 +08:00
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
pub use owned_stack::OwnedStack;
|
|
|
|
|
2016-08-11 12:05:36 +08:00
|
|
|
#[cfg(unix)]
|
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;
|
|
|
|
|
|
|
|
mod context;
|
2016-08-19 21:58:45 +08:00
|
|
|
mod stack;
|
|
|
|
mod slice_stack;
|
2016-07-17 11:11:33 +08:00
|
|
|
pub mod generator;
|
2015-04-16 14:30:10 +08:00
|
|
|
|
2016-08-19 21:58:45 +08:00
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
mod owned_stack;
|
|
|
|
|
2016-08-11 12:05:36 +08:00
|
|
|
#[cfg(unix)]
|
2015-04-16 19:45:14 +08:00
|
|
|
mod os;
|