diff options
| author | bors <bors@rust-lang.org> | 2014-06-16 08:16:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-16 08:16:49 +0000 |
| commit | 7ec78053ec5fcabd5f8ca98627dd45bfa5fc4cd4 (patch) | |
| tree | 1ea55f8c25540e7339e27fe9dd79cadbc332634f /src/libgreen | |
| parent | 2ef910f71ab83761b1f5f9144621f246622e92d8 (diff) | |
| parent | 89b0e6e12ba2fb24ec0e6655a1130c16eb8d1745 (diff) | |
| download | rust-7ec78053ec5fcabd5f8ca98627dd45bfa5fc4cd4.tar.gz rust-7ec78053ec5fcabd5f8ca98627dd45bfa5fc4cd4.zip | |
auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
Closes #14898 Closes #14918
Diffstat (limited to 'src/libgreen')
| -rw-r--r-- | src/libgreen/basic.rs | 22 | ||||
| -rw-r--r-- | src/libgreen/lib.rs | 8 | ||||
| -rw-r--r-- | src/libgreen/sched.rs | 14 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/libgreen/basic.rs b/src/libgreen/basic.rs index 7f033a1bc61..2381626b7c8 100644 --- a/src/libgreen/basic.rs +++ b/src/libgreen/basic.rs @@ -23,16 +23,16 @@ use std::rt::rtio::{PausableIdleCallback, Callback}; use std::rt::exclusive::Exclusive; /// This is the only exported function from this module. -pub fn event_loop() -> Box<EventLoop:Send> { - box BasicLoop::new() as Box<EventLoop:Send> +pub fn event_loop() -> Box<EventLoop + Send> { + box BasicLoop::new() as Box<EventLoop + Send> } struct BasicLoop { - work: Vec<proc():Send>, // pending work - remotes: Vec<(uint, Box<Callback:Send>)>, + work: Vec<proc(): Send>, // pending work + remotes: Vec<(uint, Box<Callback + Send>)>, next_remote: uint, messages: Arc<Exclusive<Vec<Message>>>, - idle: Option<Box<Callback:Send>>, + idle: Option<Box<Callback + Send>>, idle_active: Option<Arc<atomics::AtomicBool>>, } @@ -132,22 +132,22 @@ impl EventLoop for BasicLoop { } // FIXME: Seems like a really weird requirement to have an event loop provide. - fn pausable_idle_callback(&mut self, cb: Box<Callback:Send>) - -> Box<PausableIdleCallback:Send> { + fn pausable_idle_callback(&mut self, cb: Box<Callback + Send>) + -> Box<PausableIdleCallback + Send> { rtassert!(self.idle.is_none()); self.idle = Some(cb); let a = Arc::new(atomics::AtomicBool::new(true)); self.idle_active = Some(a.clone()); - box BasicPausable { active: a } as Box<PausableIdleCallback:Send> + box BasicPausable { active: a } as Box<PausableIdleCallback + Send> } - fn remote_callback(&mut self, f: Box<Callback:Send>) - -> Box<RemoteCallback:Send> { + fn remote_callback(&mut self, f: Box<Callback + Send>) + -> Box<RemoteCallback + Send> { let id = self.next_remote; self.next_remote += 1; self.remotes.push((id, f)); box BasicRemote::new(self.messages.clone(), id) as - Box<RemoteCallback:Send> + Box<RemoteCallback + Send> } fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory> { None } diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index e8de2b9bd93..6c3ad8a6ef9 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -288,7 +288,7 @@ macro_rules! green_start( ($f:ident) => ( /// The return value is used as the process return code. 0 on success, 101 on /// error. pub fn start(argc: int, argv: **u8, - event_loop_factory: fn() -> Box<rtio::EventLoop:Send>, + event_loop_factory: fn() -> Box<rtio::EventLoop + Send>, main: proc():Send) -> int { rt::init(argc, argv); let mut main = Some(main); @@ -309,7 +309,7 @@ pub fn start(argc: int, argv: **u8, /// /// This function will not return until all schedulers in the associated pool /// have returned. -pub fn run(event_loop_factory: fn() -> Box<rtio::EventLoop:Send>, +pub fn run(event_loop_factory: fn() -> Box<rtio::EventLoop + Send>, main: proc():Send) -> int { // Create a scheduler pool and spawn the main task into this pool. We will // get notified over a channel when the main task exits. @@ -340,7 +340,7 @@ pub struct PoolConfig { pub threads: uint, /// A factory function used to create new event loops. If this is not /// specified then the default event loop factory is used. - pub event_loop_factory: fn() -> Box<rtio::EventLoop:Send>, + pub event_loop_factory: fn() -> Box<rtio::EventLoop + Send>, } impl PoolConfig { @@ -365,7 +365,7 @@ pub struct SchedPool { stack_pool: StackPool, deque_pool: deque::BufferPool<Box<task::GreenTask>>, sleepers: SleeperList, - factory: fn() -> Box<rtio::EventLoop:Send>, + factory: fn() -> Box<rtio::EventLoop + Send>, task_state: TaskState, tasks_done: Receiver<()>, } diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 1e8f774ea16..75af52ac680 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -83,7 +83,7 @@ pub struct Scheduler { /// A fast XorShift rng for scheduler use rng: XorShiftRng, /// A toggleable idle callback - idle_callback: Option<Box<PausableIdleCallback:Send>>, + idle_callback: Option<Box<PausableIdleCallback + Send>>, /// A countdown that starts at a random value and is decremented /// every time a yield check is performed. When it hits 0 a task /// will yield. @@ -100,7 +100,7 @@ pub struct Scheduler { // destroyed before it's actually destroyed. /// The event loop used to drive the scheduler and perform I/O - pub event_loop: Box<EventLoop:Send>, + pub event_loop: Box<EventLoop + Send>, } /// An indication of how hard to work on a given operation, the difference @@ -123,7 +123,7 @@ impl Scheduler { // * Initialization Functions pub fn new(pool_id: uint, - event_loop: Box<EventLoop:Send>, + event_loop: Box<EventLoop + Send>, work_queue: deque::Worker<Box<GreenTask>>, work_queues: Vec<deque::Stealer<Box<GreenTask>>>, sleeper_list: SleeperList, @@ -136,7 +136,7 @@ impl Scheduler { } pub fn new_special(pool_id: uint, - event_loop: Box<EventLoop:Send>, + event_loop: Box<EventLoop + Send>, work_queue: deque::Worker<Box<GreenTask>>, work_queues: Vec<deque::Stealer<Box<GreenTask>>>, sleeper_list: SleeperList, @@ -183,7 +183,7 @@ impl Scheduler { pub fn bootstrap(mut ~self) { // Build an Idle callback. - let cb = box SchedRunner as Box<Callback:Send>; + let cb = box SchedRunner as Box<Callback + Send>; self.idle_callback = Some(self.event_loop.pausable_idle_callback(cb)); // Create a task for the scheduler with an empty context. @@ -231,7 +231,7 @@ impl Scheduler { // mutable reference to the event_loop to give it the "run" // command. unsafe { - let event_loop: *mut Box<EventLoop:Send> = &mut self.event_loop; + let event_loop: *mut Box<EventLoop + Send> = &mut self.event_loop; // Our scheduler must be in the task before the event loop // is started. stask.put_with_sched(self); @@ -904,7 +904,7 @@ pub enum SchedMessage { } pub struct SchedHandle { - remote: Box<RemoteCallback:Send>, + remote: Box<RemoteCallback + Send>, queue: msgq::Producer<SchedMessage>, pub sched_id: uint } |
