aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/workqueue.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-06-27 22:10:40 +0200
committerMs2ger <ms2ger@gmail.com>2015-06-27 22:10:40 +0200
commitb2c226afe68f9902fc904630802812270342c861 (patch)
tree224e7fa47272ad0bb390336983d1c5d61305574b /components/util/workqueue.rs
parent53c04b33f00ac5fc25d7d98dbb2cf0b983ddd3bd (diff)
downloadservo-b2c226afe68f9902fc904630802812270342c861.tar.gz
servo-b2c226afe68f9902fc904630802812270342c861.zip
Move back to using a labeled break in WorkQueue.
This was changed in 18a2050a64cd6f320cc59cb490a69b0e895f11d3; it appears to work fine now.
Diffstat (limited to 'components/util/workqueue.rs')
-rw-r--r--components/util/workqueue.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs
index 2f0523a09ef..f5f83567da3 100644
--- a/components/util/workqueue.rs
+++ b/components/util/workqueue.rs
@@ -114,20 +114,13 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
let mut back_off_sleep = 0 as u32;
// We're off!
- //
- // FIXME(pcwalton): Can't use labeled break or continue cross-crate due to a Rust bug.
- loop {
- // FIXME(pcwalton): Nasty workaround for the lack of labeled break/continue
- // cross-crate.
- let mut work_unit = unsafe {
- mem::uninitialized()
- };
+ 'outer: loop {
+ let work_unit;
match deque.pop() {
Some(work) => work_unit = work,
None => {
// Become a thief.
let mut i = 0;
- let mut should_continue = true;
loop {
// Don't just use `rand % len` because that's slow on ARM.
let mut victim;
@@ -153,10 +146,7 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
if back_off_sleep >= BACKOFF_INCREMENT_IN_US *
BACKOFFS_UNTIL_CONTROL_CHECK {
match self.port.try_recv() {
- Ok(WorkerMsg::Stop) => {
- should_continue = false;
- break
- }
+ Ok(WorkerMsg::Stop) => break 'outer,
Ok(WorkerMsg::Exit) => return,
Ok(_) => panic!("unexpected message"),
_ => {}
@@ -172,10 +162,6 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
i += 1
}
}
-
- if !should_continue {
- break
- }
}
}