]> git.lizzy.rs Git - rust.git/commitdiff
green: Fix missing Send bounds on procedures
authorAlex Crichton <alex@alexcrichton.com>
Sat, 19 Apr 2014 18:23:21 +0000 (11:23 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 19 Apr 2014 19:35:56 +0000 (12:35 -0700)
These were mistakenly not updated as part of the removal of the Send bound by
default on procedures.

cc #13629

src/libgreen/basic.rs
src/libgreen/context.rs
src/libgreen/lib.rs
src/libgreen/sched.rs
src/libgreen/simple.rs
src/libgreen/task.rs

index 2877768dd8bfe1aee20e3fc9aae592e8a4a5e742..3aa3d6742eb00e1f7683a64e7d54722b97107630 100644 (file)
@@ -243,7 +243,7 @@ fn pool() -> SchedPool {
         })
     }
 
-    fn run(f: proc()) {
+    fn run(f: proc():Send) {
         let mut pool = pool();
         pool.spawn(TaskOpts::new(), f);
         pool.shutdown();
index a521c9bee8787e98787157d559448d9bd0d341b9..0a3d6a78034643f22f3186fefc37059ba92c621f 100644 (file)
@@ -46,7 +46,7 @@ pub fn empty() -> Context {
     /// FIXME: this is basically an awful the interface. The main reason for
     ///        this is to reduce the number of allocations made when a green
     ///        task is spawned as much as possible
-    pub fn new(init: InitFn, arg: uint, start: proc(),
+    pub fn new(init: InitFn, arg: uint, start: proc():Send,
                stack: &mut Stack) -> Context {
 
         let sp: *uint = stack.end();
index dd897b9db4bafe8564a40f35044d4f0f2588541b..77715b1f5fb38001ba29008dbc19a4bf85f5000d 100644 (file)
@@ -289,7 +289,7 @@ fn start(argc: int, argv: **u8) -> int {
 /// error.
 pub fn start(argc: int, argv: **u8,
              event_loop_factory: fn() -> ~rtio::EventLoop:Send,
-             main: proc()) -> int {
+             main: proc():Send) -> int {
     rt::init(argc, argv);
     let mut main = Some(main);
     let mut ret = None;
@@ -310,7 +310,7 @@ pub fn start(argc: int, argv: **u8,
 /// This function will not return until all schedulers in the associated pool
 /// have returned.
 pub fn run(event_loop_factory: fn() -> ~rtio::EventLoop:Send,
-           main: proc()) -> int {
+           main: proc():Send) -> int {
     // Create a scheduler pool and spawn the main task into this pool. We will
     // get notified over a channel when the main task exits.
     let mut cfg = PoolConfig::new();
@@ -445,7 +445,7 @@ pub fn new(config: PoolConfig) -> SchedPool {
     /// This is useful to create a task which can then be sent to a specific
     /// scheduler created by `spawn_sched` (and possibly pin it to that
     /// scheduler).
-    pub fn task(&mut self, opts: TaskOpts, f: proc()) -> ~GreenTask {
+    pub fn task(&mut self, opts: TaskOpts, f: proc():Send) -> ~GreenTask {
         GreenTask::configure(&mut self.stack_pool, opts, f)
     }
 
@@ -455,7 +455,7 @@ pub fn task(&mut self, opts: TaskOpts, f: proc()) -> ~GreenTask {
     /// New tasks are spawned in a round-robin fashion to the schedulers in this
     /// pool, but tasks can certainly migrate among schedulers once they're in
     /// the pool.
-    pub fn spawn(&mut self, opts: TaskOpts, f: proc()) {
+    pub fn spawn(&mut self, opts: TaskOpts, f: proc():Send) {
         let task = self.task(opts, f);
 
         // Figure out someone to send this task to
index 922a5905fafd7f86bc584bb85a6181e2258f95f0..74872086b35c6e54bcb1572047120f3bd3338c2c 100644 (file)
@@ -1027,7 +1027,7 @@ fn pool() -> SchedPool {
         })
     }
 
-    fn run(f: proc()) {
+    fn run(f: proc():Send) {
         let mut pool = pool();
         pool.spawn(TaskOpts::new(), f);
         pool.shutdown();
index 75a53b0bbd3ef741193145c776bf410d854f77d4..4f2f0c1addb3671cdec005cfc51b22c7d364174d 100644 (file)
@@ -72,7 +72,7 @@ fn reawaken(mut ~self, mut to_wake: ~Task) {
     // feet and running.
     fn yield_now(~self, _cur_task: ~Task) { fail!() }
     fn maybe_yield(~self, _cur_task: ~Task) { fail!() }
-    fn spawn_sibling(~self, _cur_task: ~Task, _opts: TaskOpts, _f: proc()) {
+    fn spawn_sibling(~self, _cur_task: ~Task, _opts: TaskOpts, _f: proc():Send) {
         fail!()
     }
     fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { None }
index 534e9f8401e9d718580143efc40f4bab0dd21509..150e2704c5977c7397e526d07851fd91cee8e867 100644 (file)
@@ -129,7 +129,7 @@ impl GreenTask {
     /// and will not have any contained Task structure.
     pub fn new(stack_pool: &mut StackPool,
                stack_size: Option<uint>,
-               start: proc()) -> ~GreenTask {
+               start: proc():Send) -> ~GreenTask {
         GreenTask::new_homed(stack_pool, stack_size, AnySched, start)
     }
 
@@ -137,7 +137,7 @@ pub fn new(stack_pool: &mut StackPool,
     pub fn new_homed(stack_pool: &mut StackPool,
                      stack_size: Option<uint>,
                      home: Home,
-                     start: proc()) -> ~GreenTask {
+                     start: proc():Send) -> ~GreenTask {
         // Allocate ourselves a GreenTask structure
         let mut ops = GreenTask::new_typed(None, TypeGreen(Some(home)));
 
@@ -175,7 +175,7 @@ pub fn new_typed(coroutine: Option<Coroutine>,
     /// new stack for this task.
     pub fn configure(pool: &mut StackPool,
                      opts: TaskOpts,
-                     f: proc()) -> ~GreenTask {
+                     f: proc():Send) -> ~GreenTask {
         let TaskOpts {
             notify_chan, name, stack_size,
             stderr, stdout,
@@ -443,7 +443,7 @@ fn reawaken(mut ~self, to_wake: ~Task) {
         }
     }
 
-    fn spawn_sibling(mut ~self, cur_task: ~Task, opts: TaskOpts, f: proc()) {
+    fn spawn_sibling(mut ~self, cur_task: ~Task, opts: TaskOpts, f: proc():Send) {
         self.put_task(cur_task);
 
         // Spawns a task into the current scheduler. We allocate the new task's
@@ -490,7 +490,7 @@ mod tests {
     use super::super::{PoolConfig, SchedPool};
     use super::GreenTask;
 
-    fn spawn_opts(opts: TaskOpts, f: proc()) {
+    fn spawn_opts(opts: TaskOpts, f: proc():Send) {
         let mut pool = SchedPool::new(PoolConfig {
             threads: 1,
             event_loop_factory: ::rustuv::event_loop,