]> git.lizzy.rs Git - rust.git/commitdiff
std: Remove get_task function. Unused
authorBrian Anderson <banderson@mozilla.com>
Mon, 29 Jul 2013 19:51:55 +0000 (12:51 -0700)
committerBrian Anderson <banderson@mozilla.com>
Wed, 31 Jul 2013 00:10:21 +0000 (17:10 -0700)
src/libstd/task/mod.rs
src/test/compile-fail/fully-qualified-type-name4.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/task-killjoin-rsrc.rs

index 7dec63aef58039b61f2c69ead2c3f4b42498ce2a..5673e10062550df3d5f05a6f077fa77f62e1f17b 100644 (file)
@@ -44,7 +44,6 @@
 use result;
 use rt::{context, OldTaskContext, TaskContext};
 use rt::local::Local;
-use task::rt::task_id;
 use unstable::finally::Finally;
 use util;
 
 pub mod rt;
 pub mod spawn;
 
-/// A handle to a task
-#[deriving(Eq)]
-pub enum Task {
-    TaskHandle(task_id)
-}
-
 /**
  * Indicates the manner in which a task exited.
  *
@@ -570,14 +563,6 @@ pub fn failing() -> bool {
     }
 }
 
-pub fn get_task() -> Task {
-    //! Get a handle to the running task
-
-    unsafe {
-        TaskHandle(rt::get_task_id())
-    }
-}
-
 /**
  * Temporarily make the task unkillable
  *
index f49eb5ee85aa8722a18b6b679791a476d14b93eb..6e7ba16ac0b77d2b8f8a8493d6a2b2774426a262 100644 (file)
 
 // Test that we use fully-qualified type names in error messages.
 
-use std::task::Task;
+use std::option::Option;
 
-fn bar(x: uint) -> Task {
+fn bar(x: uint) -> Option<uint> {
     return x;
-    //~^ ERROR mismatched types: expected `std::task::Task`
+    //~^ ERROR mismatched types: expected `std::option::Option<uint>`
 }
 
 fn main() {
index 14915555889d0da74d0d851f5f94da5c1ca782c1..fbd06c5e9cea1da42ef55ef707859df5ec11d3fd 100644 (file)
 
 use std::util;
 
+pub type Task = int;
+
 // tjc: I don't know why
 pub mod pipes {
+    use super::Task;
     use std::cast::{forget, transmute};
     use std::cast;
     use std::task;
@@ -21,7 +24,7 @@ pub mod pipes {
 
     pub struct Stuff<T> {
         state: state,
-        blocked_task: Option<task::Task>,
+        blocked_task: Option<Task>,
         payload: Option<T>
     }
 
@@ -35,7 +38,7 @@ pub enum state {
 
     pub struct packet<T> {
         state: state,
-        blocked_task: Option<task::Task>,
+        blocked_task: Option<Task>,
         payload: Option<T>
     }
 
@@ -43,7 +46,7 @@ pub fn packet<T:Send>() -> *packet<T> {
         unsafe {
             let p: *packet<T> = cast::transmute(~Stuff{
                 state: empty,
-                blocked_task: None::<task::Task>,
+                blocked_task: None::<Task>,
                 payload: None::<T>
             });
             p
index aa37f5e9ce9bed5e847957f38c2ec8064e407613..c811e548f3fb18f0226b94baba937a32634ea43e 100644 (file)
@@ -27,7 +27,7 @@ impl Drop for notify {
     fn drop(&self) {
         unsafe {
             error!("notify: task=%? v=%x unwinding=%b b=%b",
-                   task::get_task(),
+                   0,
                    ptr::to_unsafe_ptr(&(*(self.v))) as uint,
                    task::failing(),
                    *(self.v));
@@ -48,7 +48,7 @@ fn joinable(f: ~fn()) -> Port<bool> {
     fn wrapper(c: Chan<bool>, f: &fn()) {
         let b = @mut false;
         error!("wrapper: task=%? allocated v=%x",
-               task::get_task(),
+               0,
                ptr::to_unsafe_ptr(&(*b)) as uint);
         let _r = notify(c, b);
         f();
@@ -71,13 +71,13 @@ fn supervised() {
     // Yield to make sure the supervisor joins before we
     // fail. This is currently not needed because the supervisor
     // runs first, but I can imagine that changing.
-    error!("supervised task=%?", task::get_task);
+    error!("supervised task=%?", 0);
     task::yield();
     fail!();
 }
 
 fn supervisor() {
-    error!("supervisor task=%?", task::get_task());
+    error!("supervisor task=%?", 0);
     let t = joinable(supervised);
     join(t);
 }