Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rustcc/coroutine-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: slide-rs/bran
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 6 commits
  • 13 files changed
  • 1 contributor

Commits on Jun 5, 2015

  1. Remove task

    csherratt committed Jun 5, 2015

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    philipphofmann Philipp Hofmann
    Copy the full SHA
    feb9439 View commit details
  2. remove _clonable

    csherratt committed Jun 5, 2015
    Copy the full SHA
    c31787d View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f26d563 View commit details

Commits on Jun 6, 2015

  1. Add support for pulse

    csherratt committed Jun 6, 2015
    Copy the full SHA
    607e8a1 View commit details
  2. Added stackpool

    csherratt committed Jun 6, 2015
    Copy the full SHA
    559bb63 View commit details

Commits on Jun 28, 2015

  1. Copy the full SHA
    0b00f98 View commit details
Showing with 459 additions and 1,945 deletions.
  1. +3 −15 Cargo.toml
  2. +0 −31 examples/multithread.rs
  3. +0 −40 examples/simple.rs
  4. +0 −34 examples/threadsafe.rs
  5. +0 −47 src/benchmarks.rs
  6. +8 −24 src/builder.rs
  7. +0 −493 src/coroutine_clonable.rs
  8. +0 −492 src/coroutine_unique.rs
  9. +365 −0 src/fiber.rs
  10. +8 −39 src/lib.rs
  11. +44 −57 src/stack.rs
  12. +0 −606 src/task.rs
  13. +31 −67 src/tests.rs
18 changes: 3 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "coroutine"
name = "bran"
version = "0.2.0"
authors = [
"Y. T. Chung <zonyitoo@gmail.com>",
@@ -14,29 +14,17 @@ homepage = "https://github.com/rustcc/coroutine-rs"
build = "build.rs"
keywords = ["coroutine", "green", "thread", "fiber"]

[features]
default = [
"enable-clonable-handle",
]

enable-clonable-handle = [
"spin"
]

[build-dependencies]
gcc = "*"
log = "*"

[lib]
name = "coroutine"
name = "bran"
path = "src/lib.rs"

[dependencies]
mmap = "*"

[dependencies.spin]
version = "*"
optional = true
pulse = "*"

[dev-dependencies]
num_cpus = "*"
31 changes: 0 additions & 31 deletions examples/multithread.rs

This file was deleted.

40 changes: 0 additions & 40 deletions examples/simple.rs

This file was deleted.

34 changes: 0 additions & 34 deletions examples/threadsafe.rs

This file was deleted.

47 changes: 0 additions & 47 deletions src/benchmarks.rs

This file was deleted.

32 changes: 8 additions & 24 deletions src/builder.rs
Original file line number Diff line number Diff line change
@@ -19,12 +19,12 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

use coroutine::{Coroutine, Handle, Options};
use fiber::{Fiber, Handle, Options};

/// Coroutine configuration. Provides detailed control over the properties and behavior of new Coroutines.
/// Fiber configuration. Provides detailed control over the properties and behavior of new Fibers.
///
/// ```ignore
/// let coro = Builder::new().name(format!("Coroutine #{}", 1))
/// let coro = Builder::new().name(format!("Fiber #{}", 1))
/// .stack_size(4096)
/// .spawn(|| println!("Hello world!!"));
///
@@ -35,45 +35,29 @@ pub struct Builder {
}

impl Builder {
/// Generate the base configuration for spawning a Coroutine, from which configuration methods can be chained.
/// Generate the base configuration for spawning a Fiber, from which configuration methods can be chained.
pub fn new() -> Builder {
Builder {
opts: Default::default(),
}
}

/// Name the Coroutine-to-be. Currently the name is used for identification only in panic messages.
/// Name the Fiber-to-be. Currently the name is used for identification only in panic messages.
pub fn name(mut self, name: String) -> Builder {
self.opts.name = Some(name);
self
}

/// Set the size of the stack for the new Coroutine.
/// Set the size of the stack for the new Fiber.
pub fn stack_size(mut self, size: usize) -> Builder {
self.opts.stack_size = size;
self
}

/// Spawn a new Coroutine, and return a handle for it.
/// Spawn a new Fiber, and return a handle for it.
pub fn spawn<F>(self, f: F) -> Handle
where F: FnOnce() + Send + 'static
{
Coroutine::spawn_opts(f, self.opts)
}
}

#[cfg(test)]
mod test {
use std::sync::mpsc::channel;

use super::Builder;

#[test]
fn test_builder_basic() {
let (tx, rx) = channel();
Builder::new().name("Test builder".to_string()).spawn(move|| {
tx.send(1).unwrap();
}).join().ok().expect("Failed to join");
assert_eq!(rx.recv().unwrap(), 1);
Fiber::spawn_opts(f, self.opts)
}
}
Loading