diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-03-08 18:21:49 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-03-27 10:14:50 -0700 |
| commit | bb9172d7b512c36f34d34b024640f030d1fde2eb (patch) | |
| tree | 0e4ea18ae30a12954db6b9fbe95f62222ade9301 /src/libnative | |
| parent | bdd24b2a56e8bf6b952bd8880364fb0a57c2c540 (diff) | |
| download | rust-bb9172d7b512c36f34d34b024640f030d1fde2eb.tar.gz rust-bb9172d7b512c36f34d34b024640f030d1fde2eb.zip | |
Fix fallout of removing default bounds
This is all purely fallout of getting the previous commit to compile.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/file_unix.rs | 4 | ||||
| -rw-r--r-- | src/libnative/io/mod.rs | 50 | ||||
| -rw-r--r-- | src/libnative/io/net.rs | 16 | ||||
| -rw-r--r-- | src/libnative/io/pipe_unix.rs | 12 | ||||
| -rw-r--r-- | src/libnative/task.rs | 23 |
5 files changed, 53 insertions, 52 deletions
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs index b997aa4f11c..2e33110b700 100644 --- a/src/libnative/io/file_unix.rs +++ b/src/libnative/io/file_unix.rs @@ -176,8 +176,8 @@ impl rtio::RtioPipe for FileDesc { fn write(&mut self, buf: &[u8]) -> Result<(), IoError> { self.inner_write(buf) } - fn clone(&self) -> ~rtio::RtioPipe { - ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe + fn clone(&self) -> ~rtio::RtioPipe:Send { + ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send } } diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index e802c8f0301..3536ec7dec6 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -227,20 +227,20 @@ impl IoFactory { impl rtio::IoFactory for IoFactory { // networking - fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream> { - net::TcpStream::connect(addr).map(|s| ~s as ~RtioTcpStream) + fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream:Send> { + net::TcpStream::connect(addr).map(|s| ~s as ~RtioTcpStream:Send) } - fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener> { - net::TcpListener::bind(addr).map(|s| ~s as ~RtioTcpListener) + fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send> { + net::TcpListener::bind(addr).map(|s| ~s as ~RtioTcpListener:Send) } - fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket> { - net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket) + fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send> { + net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket:Send) } - fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener> { - pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener) + fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener:Send> { + pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener:Send) } - fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe> { - pipe::UnixStream::connect(path).map(|s| ~s as ~RtioPipe) + fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe:Send> { + pipe::UnixStream::connect(path).map(|s| ~s as ~RtioPipe:Send) } fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> { @@ -249,16 +249,16 @@ impl rtio::IoFactory for IoFactory { // filesystem operations fn fs_from_raw_fd(&mut self, fd: c_int, - close: CloseBehavior) -> ~RtioFileStream { + close: CloseBehavior) -> ~RtioFileStream:Send { let close = match close { rtio::CloseSynchronously | rtio::CloseAsynchronously => true, rtio::DontClose => false }; - ~file::FileDesc::new(fd, close) as ~RtioFileStream + ~file::FileDesc::new(fd, close) as ~RtioFileStream:Send } fn fs_open(&mut self, path: &CString, fm: io::FileMode, fa: io::FileAccess) - -> IoResult<~RtioFileStream> { - file::open(path, fm, fa).map(|fd| ~fd as ~RtioFileStream) + -> IoResult<~RtioFileStream:Send> { + file::open(path, fm, fa).map(|fd| ~fd as ~RtioFileStream:Send) } fn fs_unlink(&mut self, path: &CString) -> IoResult<()> { file::unlink(path) @@ -304,25 +304,27 @@ impl rtio::IoFactory for IoFactory { } // misc - fn timer_init(&mut self) -> IoResult<~RtioTimer> { - timer::Timer::new().map(|t| ~t as ~RtioTimer) + fn timer_init(&mut self) -> IoResult<~RtioTimer:Send> { + timer::Timer::new().map(|t| ~t as ~RtioTimer:Send) } fn spawn(&mut self, config: ProcessConfig) - -> IoResult<(~RtioProcess, ~[Option<~RtioPipe>])> { + -> IoResult<(~RtioProcess:Send, ~[Option<~RtioPipe:Send>])> { process::Process::spawn(config).map(|(p, io)| { - (~p as ~RtioProcess, - io.move_iter().map(|p| p.map(|p| ~p as ~RtioPipe)).collect()) + (~p as ~RtioProcess:Send, + io.move_iter().map(|p| p.map(|p| ~p as ~RtioPipe:Send)).collect()) }) } fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> { process::Process::kill(pid, signum) } - fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe> { - Ok(~file::FileDesc::new(fd, true) as ~RtioPipe) + fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe:Send> { + Ok(~file::FileDesc::new(fd, true) as ~RtioPipe:Send) } - fn tty_open(&mut self, fd: c_int, _readable: bool) -> IoResult<~RtioTTY> { + fn tty_open(&mut self, fd: c_int, _readable: bool) + -> IoResult<~RtioTTY:Send> + { if unsafe { libc::isatty(fd) } != 0 { - Ok(~file::FileDesc::new(fd, true) as ~RtioTTY) + Ok(~file::FileDesc::new(fd, true) as ~RtioTTY:Send) } else { Err(IoError { kind: io::MismatchedFileTypeForOperation, @@ -332,7 +334,7 @@ impl rtio::IoFactory for IoFactory { } } fn signal(&mut self, _signal: Signum, _channel: Sender<Signum>) - -> IoResult<~RtioSignal> { + -> IoResult<~RtioSignal:Send> { Err(unimpl()) } } diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index 6a711072942..6f6ddeec86b 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -348,8 +348,8 @@ impl rtio::RtioTcpStream for TcpStream { self.set_keepalive(None) } - fn clone(&self) -> ~rtio::RtioTcpStream { - ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream + fn clone(&self) -> ~rtio::RtioTcpStream:Send { + ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream:Send } fn close_write(&mut self) -> IoResult<()> { super::mkerr_libc(unsafe { @@ -418,8 +418,8 @@ impl TcpListener { } impl rtio::RtioTcpListener for TcpListener { - fn listen(~self) -> IoResult<~rtio::RtioTcpAcceptor> { - self.native_listen(128).map(|a| ~a as ~rtio::RtioTcpAcceptor) + fn listen(~self) -> IoResult<~rtio::RtioTcpAcceptor:Send> { + self.native_listen(128).map(|a| ~a as ~rtio::RtioTcpAcceptor:Send) } } @@ -461,8 +461,8 @@ impl rtio::RtioSocket for TcpAcceptor { } impl rtio::RtioTcpAcceptor for TcpAcceptor { - fn accept(&mut self) -> IoResult<~rtio::RtioTcpStream> { - self.native_accept().map(|s| ~s as ~rtio::RtioTcpStream) + fn accept(&mut self) -> IoResult<~rtio::RtioTcpStream:Send> { + self.native_accept().map(|s| ~s as ~rtio::RtioTcpStream:Send) } fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) } @@ -630,7 +630,7 @@ impl rtio::RtioUdpSocket for UdpSocket { self.set_broadcast(false) } - fn clone(&self) -> ~rtio::RtioUdpSocket { - ~UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket + fn clone(&self) -> ~rtio::RtioUdpSocket:Send { + ~UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket:Send } } diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index 9e81dc02cc5..e25571d02c9 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -150,8 +150,8 @@ impl rtio::RtioPipe for UnixStream { } } - fn clone(&self) -> ~rtio::RtioPipe { - ~UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe + fn clone(&self) -> ~rtio::RtioPipe:Send { + ~UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe:Send } } @@ -250,8 +250,8 @@ impl UnixListener { } impl rtio::RtioUnixListener for UnixListener { - fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor> { - self.native_listen(128).map(|a| ~a as ~rtio::RtioUnixAcceptor) + fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor:Send> { + self.native_listen(128).map(|a| ~a as ~rtio::RtioUnixAcceptor:Send) } } @@ -279,7 +279,7 @@ impl UnixAcceptor { } impl rtio::RtioUnixAcceptor for UnixAcceptor { - fn accept(&mut self) -> IoResult<~rtio::RtioPipe> { - self.native_accept().map(|s| ~s as ~rtio::RtioPipe) + fn accept(&mut self) -> IoResult<~rtio::RtioPipe:Send> { + self.native_accept().map(|s| ~s as ~rtio::RtioPipe:Send) } } diff --git a/src/libnative/task.rs b/src/libnative/task.rs index 659e417b8ad..662c6417ca8 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -35,7 +35,7 @@ pub fn new(stack_bounds: (uint, uint)) -> ~Task { let mut task = ~Task::new(); let mut ops = ops(); ops.stack_bounds = stack_bounds; - task.put_runtime(ops as ~rt::Runtime); + task.put_runtime(ops); return task; } @@ -50,13 +50,13 @@ fn ops() -> ~Ops { } /// Spawns a function with the default configuration -pub fn spawn(f: proc()) { +pub fn spawn(f: proc:Send()) { spawn_opts(TaskOpts::new(), f) } /// Spawns a new task given the configuration options and a procedure to run /// inside the task. -pub fn spawn_opts(opts: TaskOpts, f: proc()) { +pub fn spawn_opts(opts: TaskOpts, f: proc:Send()) { let TaskOpts { notify_chan, name, stack_size, stderr, stdout, @@ -98,7 +98,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) { let mut f = Some(f); let mut task = task; - task.put_runtime(ops as ~rt::Runtime); + task.put_runtime(ops); let t = task.run(|| { f.take_unwrap()() }); drop(t); bookkeeping::decrement(); @@ -121,7 +121,7 @@ struct Ops { impl rt::Runtime for Ops { fn yield_now(~self, mut cur_task: ~Task) { // put the task back in TLS and then invoke the OS thread yield - cur_task.put_runtime(self as ~rt::Runtime); + cur_task.put_runtime(self); Local::put(cur_task); Thread::yield_now(); } @@ -129,7 +129,7 @@ impl rt::Runtime for Ops { fn maybe_yield(~self, mut cur_task: ~Task) { // just put the task back in TLS, on OS threads we never need to // opportunistically yield b/c the OS will do that for us (preemption) - cur_task.put_runtime(self as ~rt::Runtime); + cur_task.put_runtime(self); Local::put(cur_task); } @@ -183,7 +183,7 @@ impl rt::Runtime for Ops { fn deschedule(mut ~self, times: uint, mut cur_task: ~Task, f: |BlockedTask| -> Result<(), BlockedTask>) { let me = &mut *self as *mut Ops; - cur_task.put_runtime(self as ~rt::Runtime); + cur_task.put_runtime(self); unsafe { let cur_task_dupe = &*cur_task as *Task; @@ -230,7 +230,7 @@ impl rt::Runtime for Ops { fn reawaken(mut ~self, mut to_wake: ~Task) { unsafe { let me = &mut *self as *mut Ops; - to_wake.put_runtime(self as ~rt::Runtime); + to_wake.put_runtime(self); cast::forget(to_wake); let guard = (*me).lock.lock(); (*me).awoken = true; @@ -238,8 +238,8 @@ impl rt::Runtime for Ops { } } - fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc()) { - cur_task.put_runtime(self as ~rt::Runtime); + fn spawn_sibling(~self, mut cur_task: ~Task, opts: TaskOpts, f: proc:Send()) { + cur_task.put_runtime(self); Local::put(cur_task); task::spawn_opts(opts, f); @@ -252,7 +252,6 @@ impl rt::Runtime for Ops { #[cfg(test)] mod tests { - use std::rt::Runtime; use std::rt::local::Local; use std::rt::task::Task; use std::task; @@ -335,7 +334,7 @@ mod tests { let mut task: ~Task = Local::take(); match task.maybe_take_runtime::<Ops>() { Some(ops) => { - task.put_runtime(ops as ~Runtime); + task.put_runtime(ops); } None => fail!(), } |
