about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-05-19 14:05:20 -0700
committerBrian Anderson <banderson@mozilla.com>2013-05-20 15:20:50 -0700
commitf59fcd5d5f7ba94f7c705eb2c081760dd2213067 (patch)
treecbbeaf2fa922c43feea9b84d328d1f71b493fba2
parent43c6f32ece85a7df86ee041771a54c097dae6a13 (diff)
downloadrust-f59fcd5d5f7ba94f7c705eb2c081760dd2213067.tar.gz
rust-f59fcd5d5f7ba94f7c705eb2c081760dd2213067.zip
core::rt: Store Task as a ~ pointer
-rw-r--r--src/libcore/rt/sched.rs6
-rw-r--r--src/libcore/rt/task.rs4
-rw-r--r--src/libcore/rt/test.rs12
3 files changed, 11 insertions, 11 deletions
diff --git a/src/libcore/rt/sched.rs b/src/libcore/rt/sched.rs
index 4b2165b4d2a..3abbb1f79e5 100644
--- a/src/libcore/rt/sched.rs
+++ b/src/libcore/rt/sched.rs
@@ -350,16 +350,16 @@ pub struct Coroutine {
     /// the task is dead
     priv saved_context: Context,
     /// The heap, GC, unwinding, local storage, logging
-    task: Task
+    task: ~Task
 }
 
 pub impl Coroutine {
     fn new(stack_pool: &mut StackPool, start: ~fn()) -> Coroutine {
-        Coroutine::with_task(stack_pool, Task::new(), start)
+        Coroutine::with_task(stack_pool, ~Task::new(), start)
     }
 
     fn with_task(stack_pool: &mut StackPool,
-                  task: Task,
+                  task: ~Task,
                   start: ~fn()) -> Coroutine {
         let start = Coroutine::build_start_wrapper(start);
         let mut stack = stack_pool.take_segment(MIN_STACK_SIZE);
diff --git a/src/libcore/rt/task.rs b/src/libcore/rt/task.rs
index c3832d1338a..65b7c885b57 100644
--- a/src/libcore/rt/task.rs
+++ b/src/libcore/rt/task.rs
@@ -155,7 +155,7 @@ pub fn borrow_local_task(f: &fn(&mut Task)) {
     do local_sched::borrow |sched| {
         match sched.current_task {
             Some(~ref mut task) => {
-                f(&mut task.task)
+                f(&mut *task.task)
             }
             None => {
                 fail!("no local services for schedulers yet")
@@ -167,7 +167,7 @@ pub fn borrow_local_task(f: &fn(&mut Task)) {
 pub unsafe fn unsafe_borrow_local_task() -> *mut Task {
     match (*local_sched::unsafe_borrow()).current_task {
         Some(~ref mut task) => {
-            let s: *mut Task = &mut task.task;
+            let s: *mut Task = &mut *task.task;
             return s;
         }
         None => {
diff --git a/src/libcore/rt/test.rs b/src/libcore/rt/test.rs
index c3e52594d6e..66993041752 100644
--- a/src/libcore/rt/test.rs
+++ b/src/libcore/rt/test.rs
@@ -29,7 +29,7 @@ pub fn run_in_newsched_task(f: ~fn()) {
     do run_in_bare_thread {
         let mut sched = ~UvEventLoop::new_scheduler();
         let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                         Task::without_unwinding(),
+                                         ~Task::without_unwinding(),
                                          f.take());
         sched.enqueue_task(task);
         sched.run();
@@ -42,7 +42,7 @@ pub fn spawntask(f: ~fn()) {
 
     let mut sched = local_sched::take();
     let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                     Task::without_unwinding(),
+                                     ~Task::without_unwinding(),
                                      f);
     do sched.switch_running_tasks_and_then(task) |task| {
         let task = Cell(task);
@@ -57,7 +57,7 @@ pub fn spawntask_immediately(f: ~fn()) {
 
     let mut sched = local_sched::take();
     let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                     Task::without_unwinding(),
+                                     ~Task::without_unwinding(),
                                      f);
     do sched.switch_running_tasks_and_then(task) |task| {
         let task = Cell(task);
@@ -73,7 +73,7 @@ pub fn spawntask_later(f: ~fn()) {
 
     let mut sched = local_sched::take();
     let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                     Task::without_unwinding(),
+                                     ~Task::without_unwinding(),
                                      f);
 
     sched.enqueue_task(task);
@@ -90,7 +90,7 @@ pub fn spawntask_random(f: ~fn()) {
 
     let mut sched = local_sched::take();
     let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                     Task::without_unwinding(),
+                                     ~Task::without_unwinding(),
                                      f);
 
     if run_now {
@@ -156,7 +156,7 @@ pub fn spawntask_thread(f: ~fn()) -> Thread {
     let thread = do Thread::start {
         let mut sched = ~UvEventLoop::new_scheduler();
         let task = ~Coroutine::with_task(&mut sched.stack_pool,
-                                         Task::without_unwinding(),
+                                         ~Task::without_unwinding(),
                                          f.take());
         sched.enqueue_task(task);
         sched.run();