about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-01-21 19:22:55 -0800
committerBrian Anderson <banderson@mozilla.com>2013-01-23 17:35:34 -0800
commitcc9ab2c0339aa00566ee6c5d12383278c7bd7eef (patch)
treef45ae66e7ce00c66cae3c793d088250a4af8003b /src/libcore
parenta3e087cefacb1b92476543fe7d6ef68f0ca82dd8 (diff)
Remove old comm-based weak task interface
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/private.rs102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/libcore/private.rs b/src/libcore/private.rs
index c3068d6f61b..03207330f31 100644
--- a/src/libcore/private.rs
+++ b/src/libcore/private.rs
@@ -39,8 +39,6 @@ pub mod weak_task;
 
 extern mod rustrt {
     #[legacy_exports];
-    unsafe fn rust_task_weaken(ch: rust_port_id);
-    unsafe fn rust_task_unweaken(ch: rust_port_id);
 
     unsafe fn rust_create_little_lock() -> rust_little_lock;
     unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
@@ -92,111 +90,11 @@ fn test_run_in_bare_thread() unsafe {
     }
 }
 
-#[allow(non_camel_case_types)] // runtime type
-type rust_port_id = uint;
-
 fn compare_and_swap(address: &mut int, oldval: int, newval: int) -> bool {
     let old = rusti::atomic_cxchg(address, oldval, newval);
     old == oldval
 }
 
-/**
- * Convert the current task to a 'weak' task temporarily
- *
- * As a weak task it will not be counted towards the runtime's set
- * of live tasks. When there are no more outstanding live (non-weak) tasks
- * the runtime will send an exit message on the provided channel.
- *
- * This function is super-unsafe. Do not use.
- *
- * # Safety notes
- *
- * * Weak tasks must either die on their own or exit upon receipt of
- *   the exit message. Failure to do so will cause the runtime to never
- *   exit
- * * Tasks must not call `weaken_task` multiple times. This will
- *   break the kernel's accounting of live tasks.
- * * Weak tasks must not be supervised. A supervised task keeps
- *   a reference to its parent, so the parent will not die.
- */
-pub unsafe fn weaken_task(f: fn(oldcomm::Port<()>)) {
-    let po = oldcomm::Port();
-    let ch = oldcomm::Chan(&po);
-    unsafe {
-        rustrt::rust_task_weaken(cast::reinterpret_cast(&ch));
-    }
-    let _unweaken = Unweaken(ch);
-    f(po);
-
-    struct Unweaken {
-      ch: oldcomm::Chan<()>,
-      drop unsafe {
-        rustrt::rust_task_unweaken(cast::reinterpret_cast(&self.ch));
-      }
-    }
-
-    fn Unweaken(ch: oldcomm::Chan<()>) -> Unweaken {
-        Unweaken {
-            ch: ch
-        }
-    }
-}
-
-#[test]
-pub fn test_weaken_task_then_unweaken() {
-    do task::try {
-        unsafe {
-            do weaken_task |_po| {
-            }
-        }
-    };
-}
-
-#[test]
-pub fn test_weaken_task_wait() {
-    do task::spawn_unlinked {
-        unsafe {
-            do weaken_task |po| {
-                oldcomm::recv(po);
-            }
-        }
-    }
-}
-
-#[test]
-pub fn test_weaken_task_stress() {
-    // Create a bunch of weak tasks
-    for iter::repeat(100u) {
-        do task::spawn {
-            unsafe {
-                do weaken_task |_po| {
-                }
-            }
-        }
-        do task::spawn_unlinked {
-            unsafe {
-                do weaken_task |po| {
-                    // Wait for it to tell us to die
-                    oldcomm::recv(po);
-                }
-            }
-        }
-    }
-}
-
-#[test]
-#[ignore(cfg(windows))]
-pub fn test_weaken_task_fail() {
-    let res = do task::try {
-        unsafe {
-            do weaken_task |_po| {
-                fail;
-            }
-        }
-    };
-    assert result::is_err(&res);
-}
-
 /****************************************************************************
  * Shared state & exclusive ARC
  ****************************************************************************/