Skip to content

Commit 8551b70

Browse files
committed
spawn_with is gone with rust-lang/rust#10603
1 parent ed38319 commit 8551b70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* runs a loop that receives, dispatches and replies kernel requests.
55
*/
66

7+
use std::cell::Cell;
78
use std::task;
89
use std::libc::{EAGAIN, EINTR, ENODEV, ENOENT};
910
use channel::Channel;
@@ -78,12 +79,11 @@ impl BackgroundSession {
7879
/// Start the session loop of the given session in a background task
7980
pub fn start<FS: Filesystem+Send> (se: Session<FS>) -> BackgroundSession {
8081
let mountpoint = se.mountpoint.clone();
81-
let mut t = task::task();
82+
let se = Cell::new(se);
8283
// The background task is started using a a new single threaded
8384
// scheduler since I/O in the session loop can block
84-
t.sched_mode(task::SingleThreaded);
85-
do t.spawn_with(se) |mut se| {
86-
se.run();
85+
do task::spawn_sched(task::SingleThreaded) {
86+
se.take().run();
8787
}
8888
BackgroundSession { mountpoint: mountpoint }
8989
}

0 commit comments

Comments
 (0)