Set a name for WorkQueue tasks (fixes #1830)

This commit is contained in:
Matt Brubeck 2014-03-20 11:17:48 -07:00
parent 54da52fa77
commit f1394e3ffc
2 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@
//! Data associated with queues is simply a pair of unsigned integers. It is expected that a
//! higher-level API on top of this could allow safe fork-join parallelism.
use native;
use task;
use std::cast;
use std::comm;
use std::mem;
@ -200,7 +200,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: &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 +235,7 @@ impl<QUD:Send,WUD:Send> WorkQueue<QUD,WUD> {
// Spawn threads.
for thread in threads.move_iter() {
native::task::spawn(proc() {
task::spawn_named(task_name.to_owned(), proc() {
let mut thread = thread;
thread.start()
})