Skip to content

Instantly share code, notes, and snippets.

@brson
Last active December 14, 2015 02:59
Show Gist options
  • Save brson/5017388 to your computer and use it in GitHub Desktop.
Save brson/5017388 to your computer and use it in GitHub Desktop.

Both resume_task_from_queue and callback take &mut self

            fn run_scheduler_once() {
                do Scheduler::local |scheduler| {
                    if scheduler.resume_task_from_queue() {
                        // Ok, a task ran. Nice! We'll do it again later
                        scheduler.event_loop.callback(run_scheduler_once);
                    }
                }
            }
/home/brian/dev/rust/src/test/run-pass/newrt_sched.rs:75:24: 75:33 error: loan of dereference of mutable & pointer as immutable conflicts with prior loan
/home/brian/dev/rust/src/test/run-pass/newrt_sched.rs:75                         scheduler.event_loop.callback(run_scheduler_once);
                                                                                 ^~~~~~~~~
/home/brian/dev/rust/src/test/run-pass/newrt_sched.rs:71:24: 71:33 note: prior loan as mutable granted here
/home/brian/dev/rust/src/test/run-pass/newrt_sched.rs:71                         scheduler.resume_task_from_queue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment