Skip to content

Commit

Permalink
Rename serial_join and serial_scope to join and scope
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Oct 14, 2019
1 parent 8356022 commit b9bc431
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions src/librustc_data_structures/sync.rs
Expand Up @@ -41,29 +41,6 @@ cfg_if! {
}
}

pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
where A: FnOnce() -> RA,
B: FnOnce() -> RB
{
(oper_a(), oper_b())
}

pub struct SerialScope;

impl SerialScope {
pub fn spawn<F>(&self, f: F)
where F: FnOnce(&SerialScope)
{
f(self)
}
}

pub fn serial_scope<F, R>(f: F) -> R
where F: FnOnce(&SerialScope) -> R
{
f(&SerialScope)
}

use std::ops::Add;
use std::panic::{resume_unwind, catch_unwind, AssertUnwindSafe};

Expand Down Expand Up @@ -176,8 +153,28 @@ cfg_if! {
pub type AtomicU32 = Atomic<u32>;
pub type AtomicU64 = Atomic<u64>;

pub use self::serial_join as join;
pub use self::serial_scope as scope;
pub fn join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
where A: FnOnce() -> RA,
B: FnOnce() -> RB
{
(oper_a(), oper_b())
}

pub struct SerialScope;

impl SerialScope {
pub fn spawn<F>(&self, f: F)
where F: FnOnce(&SerialScope)
{
f(self)
}
}

pub fn scope<F, R>(f: F) -> R
where F: FnOnce(&SerialScope) -> R
{
f(&SerialScope)
}

#[macro_export]
macro_rules! parallel {
Expand Down

0 comments on commit b9bc431

Please sign in to comment.