aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/task.rs
diff options
context:
space:
mode:
authorClark Gaebel <cgaebel@mozilla.com>2014-10-28 09:53:45 -0700
committerClark Gaebel <cgaebel@mozilla.com>2014-10-28 09:53:45 -0700
commit6df1cc8e4c1ed6c4a99435808f7e236eedaed0a1 (patch)
treedbf10231b9ceee58d3891d7ffab6840f5f561ab3 /components/util/task.rs
parent9e94ecf99cff7c57275ab39c7b11870e55756d63 (diff)
downloadservo-6df1cc8e4c1ed6c4a99435808f7e236eedaed0a1.tar.gz
servo-6df1cc8e4c1ed6c4a99435808f7e236eedaed0a1.zip
Run all task spawning through util, to allow for easy hooking.
During debugging, I found it useful to hook all task creation in a central location, and util::task was the perfect place for it. r? @pcwalton (or maybe someone else, I'm kinda sending you a bunch of reviews today because I don't know who better to give them to)
Diffstat (limited to 'components/util/task.rs')
-rw-r--r--components/util/task.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/util/task.rs b/components/util/task.rs
index f286efe5bc3..f38d87d0907 100644
--- a/components/util/task.rs
+++ b/components/util/task.rs
@@ -15,6 +15,11 @@ pub fn spawn_named<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {
builder.spawn(f);
}
+pub fn spawn_named_native<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {
+ let builder = task::TaskBuilder::new().named(name).native();
+ builder.spawn(f);
+}
+
/// Arrange to send a particular message to a channel if the task fails.
pub fn spawn_named_with_send_on_failure<T: Send>(name: &'static str,
state: task_state::TaskState,