mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Set a name for WorkQueue tasks (fixes #1830)
This commit is contained in:
parent
3401a568f2
commit
00ca300305
2 changed files with 6 additions and 3 deletions
|
@ -290,7 +290,7 @@ impl LayoutTask {
|
||||||
let local_image_cache = MutexArc::new(LocalImageCache(image_cache_task.clone()));
|
let local_image_cache = MutexArc::new(LocalImageCache(image_cache_task.clone()));
|
||||||
let screen_size = Size2D(Au(0), Au(0));
|
let screen_size = Size2D(Au(0), Au(0));
|
||||||
let parallel_traversal = if opts.layout_threads != 1 {
|
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 {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,7 @@ use std::rand::{Rng, XorShiftRng};
|
||||||
use std::rand;
|
use std::rand;
|
||||||
use std::sync::atomics::{AtomicUint, SeqCst};
|
use std::sync::atomics::{AtomicUint, SeqCst};
|
||||||
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
|
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
|
||||||
|
use std::task::TaskOpts;
|
||||||
|
|
||||||
/// A unit of work.
|
/// A unit of work.
|
||||||
///
|
///
|
||||||
|
@ -200,7 +201,7 @@ pub struct WorkQueue<QUD,WUD> {
|
||||||
impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
|
impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
|
||||||
/// Creates a new work queue and spawns all the threads associated with
|
/// Creates a new work queue and spawns all the threads associated with
|
||||||
/// it.
|
/// 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.
|
// Set up data structures.
|
||||||
let (supervisor_port, supervisor_chan) = Chan::new();
|
let (supervisor_port, supervisor_chan) = Chan::new();
|
||||||
let (mut infos, mut threads) = (~[], ~[]);
|
let (mut infos, mut threads) = (~[], ~[]);
|
||||||
|
@ -235,7 +236,9 @@ impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
|
||||||
|
|
||||||
// Spawn threads.
|
// Spawn threads.
|
||||||
for thread in threads.move_iter() {
|
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;
|
let mut thread = thread;
|
||||||
thread.start()
|
thread.start()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue