aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-03-25 14:13:41 -0400
committerbors-servo <release+servo@mozilla.com>2014-03-25 14:13:41 -0400
commita8e1059f44993a28a765c22efc324a43a9115bc4 (patch)
tree762179e90e2471f37c3936e2f33c5f9feeccb265
parentfd5e5cd18b41f0ce2b33fb97fb4e3d75ddbbbceb (diff)
parent00ca300305d3b5c18b90e098e8311603a88e2b60 (diff)
downloadservo-a8e1059f44993a28a765c22efc324a43a9115bc4.tar.gz
servo-a8e1059f44993a28a765c22efc324a43a9115bc4.zip
auto merge of #1977 : mbrubeck/servo/task-name, r=jdm
Now with 100% less breaking everything. (An earlier version of this patch in #1948 switched WorkQueue from native tasks to green tasks, which I missed in testing because we don't spawn new layout threads by default on 1- or 2-core machines.)
-rw-r--r--src/components/main/layout/layout_task.rs2
-rw-r--r--src/components/util/workqueue.rs7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs
index 28c305666ae..b9050816668 100644
--- a/src/components/main/layout/layout_task.rs
+++ b/src/components/main/layout/layout_task.rs
@@ -290,7 +290,7 @@ impl LayoutTask {
let local_image_cache = MutexArc::new(LocalImageCache(image_cache_task.clone()));
let screen_size = Size2D(Au(0), Au(0));
let parallel_traversal = if opts.layout_threads != 1 {
- Some(WorkQueue::new(opts.layout_threads, ptr::mut_null()))
+ Some(WorkQueue::new("LayoutWorker", opts.layout_threads, ptr::mut_null()))
} else {
None
};
diff --git a/src/components/util/workqueue.rs b/src/components/util/workqueue.rs
index 93ea740c5a0..b5f4fc0799d 100644
--- a/src/components/util/workqueue.rs
+++ b/src/components/util/workqueue.rs
@@ -15,6 +15,7 @@ use std::rand::{Rng, XorShiftRng};
use std::rand;
use std::sync::atomics::{AtomicUint, SeqCst};
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
+use std::task::TaskOpts;
/// A unit of work.
///
@@ -200,7 +201,7 @@ pub struct WorkQueue<QUD,WUD> {
impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
/// Creates a new work queue and spawns all the threads associated with
/// it.
- pub fn new(thread_count: uint, user_data: QUD) -> WorkQueue<QUD,WUD> {
+ pub fn new(task_name: &'static str, thread_count: uint, user_data: QUD) -> WorkQueue<QUD,WUD> {
// Set up data structures.
let (supervisor_port, supervisor_chan) = Chan::new();
let (mut infos, mut threads) = (~[], ~[]);
@@ -235,7 +236,9 @@ impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
// Spawn threads.
for thread in threads.move_iter() {
- native::task::spawn(proc() {
+ let mut opts = TaskOpts::new();
+ opts.name = Some(task_name.into_maybe_owned());
+ native::task::spawn_opts(opts, proc() {
let mut thread = thread;
thread.start()
})