From 052a8962928fb9d375539cb492fbef3ff66be1c8 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Mon, 30 Sep 2019 22:08:13 -0700 Subject: [PATCH] Remove coroutine examples --- examples/Cargo.toml | 2 -- examples/coroutines/Cargo.toml | 10 ------- examples/coroutines/src/main.rs | 26 ------------------ examples/suspended_coroutines/Cargo.toml | 10 ------- examples/suspended_coroutines/src/main.rs | 33 ----------------------- 5 files changed, 81 deletions(-) delete mode 100644 examples/coroutines/Cargo.toml delete mode 100644 examples/coroutines/src/main.rs delete mode 100644 examples/suspended_coroutines/Cargo.toml delete mode 100644 examples/suspended_coroutines/src/main.rs diff --git a/examples/Cargo.toml b/examples/Cargo.toml index be26faa..5cb5511 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,9 +1,7 @@ [workspace] members = [ - "coroutines", "dynamic_threads", "free_by_borrow", "free_by_gc", "static_threads", - "suspended_coroutines", ] diff --git a/examples/coroutines/Cargo.toml b/examples/coroutines/Cargo.toml deleted file mode 100644 index b1e9856..0000000 --- a/examples/coroutines/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "coroutines" -version = "0.1.0" -authors = ["Yota Toyama "] -edition = "2018" -publish = false - -[dependencies] -bdwgc-alloc = { path = "../.." } -coroutine = "0.8" diff --git a/examples/coroutines/src/main.rs b/examples/coroutines/src/main.rs deleted file mode 100644 index 41ae7d8..0000000 --- a/examples/coroutines/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -extern crate bdwgc_alloc; -extern crate coroutine; - -use bdwgc_alloc::Allocator; -use coroutine::asymmetric::Coroutine; -use std::alloc::Layout; - -#[global_allocator] -static GLOBAL_ALLOCATOR: Allocator = Allocator; - -fn main() { - unsafe { Allocator::initialize() } - Allocator::lock(); - - let handle = Coroutine::spawn(move |_, _| { - let bottom: u8 = 0; - unsafe { Allocator::set_stack_bottom(&bottom) } - Allocator::unlock(); - - loop { - unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; - } - }); - - for _ in handle {} -} diff --git a/examples/suspended_coroutines/Cargo.toml b/examples/suspended_coroutines/Cargo.toml deleted file mode 100644 index 931ba11..0000000 --- a/examples/suspended_coroutines/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "suspended_coroutines" -version = "0.1.0" -authors = ["Yota Toyama "] -edition = "2018" -publish = false - -[dependencies] -bdwgc-alloc = { path = "../.." } -coroutine = "0.8" diff --git a/examples/suspended_coroutines/src/main.rs b/examples/suspended_coroutines/src/main.rs deleted file mode 100644 index 87d44f5..0000000 --- a/examples/suspended_coroutines/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -extern crate bdwgc_alloc; -extern crate coroutine; - -use bdwgc_alloc::Allocator; -use coroutine::asymmetric::Coroutine; -use std::alloc::Layout; - -#[global_allocator] -static GLOBAL_ALLOCATOR: Allocator = Allocator; - -fn main() { - unsafe { Allocator::initialize() } - - Allocator::lock(); - let mut handle = Coroutine::spawn(move |me, _| { - let bottom: u8 = 0; - unsafe { Allocator::set_stack_bottom(&bottom) } - Allocator::unlock(); - - me.yield_with(42); - unsafe { Allocator::set_stack_bottom(&bottom) } - Allocator::unlock(); - - loop { - unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; - } - }); - - Allocator::lock(); - assert_eq!(handle.resume(0).unwrap(), 42); - - handle.resume(0).unwrap(); -}