core::rt: Queues MessageQueue and WorkQueue are cloneable

This commit is contained in:
Brian Anderson 2013-05-18 01:53:40 -07:00
parent d2a1378ed8
commit fa18a861fb
2 changed files with 19 additions and 1 deletions

View File

@ -14,6 +14,7 @@ use vec::OwnedVector;
use cell::Cell;
use option::*;
use unstable::sync::{Exclusive, exclusive};
use clone::Clone;
pub struct MessageQueue<T> {
// XXX: Another mystery bug fixed by boxing this lock
@ -41,4 +42,12 @@ impl<T: Owned> MessageQueue<T> {
}
}
}
}
}
impl<T> Clone for MessageQueue<T> {
fn clone(&self) -> MessageQueue<T> {
MessageQueue {
queue: self.queue.clone()
}
}
}

View File

@ -14,6 +14,7 @@ use vec::OwnedVector;
use unstable::sync::{Exclusive, exclusive};
use cell::Cell;
use kinds::Owned;
use clone::Clone;
pub struct WorkQueue<T> {
// XXX: Another mystery bug fixed by boxing this lock
@ -56,3 +57,11 @@ pub impl<T: Owned> WorkQueue<T> {
self.queue.with_imm(|q| q.is_empty() )
}
}
impl<T> Clone for WorkQueue<T> {
fn clone(&self) -> WorkQueue<T> {
WorkQueue {
queue: self.queue.clone()
}
}
}