Skip to content

Commit 578a8a9

Browse files
committed
---
yaml --- r: 146159 b: refs/heads/try2 c: 0cad984 h: refs/heads/master i: 146157: 0215081 146155: 06f4f45 146151: 4c3dd9b 146143: 94485fb v: v3
1 parent cf7ca43 commit 578a8a9

File tree

14 files changed

+93
-100
lines changed

14 files changed

+93
-100
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 35756fbcf6572d588929fde64fb4027f47e9d0af
8+
refs/heads/try2: 0cad9847652088b35ee4c13c04539ca3a67611f7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/rt/io/net/tcp.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@ use result::{Ok, Err};
1313
use rt::io::net::ip::SocketAddr;
1414
use rt::io::{Reader, Writer, Listener, Acceptor};
1515
use rt::io::{io_error, read_error, EndOfFile};
16-
use rt::rtio::{IoFactory, IoFactoryObject,
17-
RtioSocket,
18-
RtioTcpListener, RtioTcpListenerObject,
19-
RtioTcpAcceptor, RtioTcpAcceptorObject,
20-
RtioTcpStream, RtioTcpStreamObject};
16+
use rt::rtio::{IoFactory, IoFactoryObject, RtioTcpListenerObject,
17+
RtioSocket, RtioTcpListener, RtioTcpAcceptor, RtioTcpStream};
2118
use rt::local::Local;
2219

2320
pub struct TcpStream {
24-
priv obj: ~RtioTcpStreamObject
21+
priv obj: ~RtioTcpStream
2522
}
2623

2724
impl TcpStream {
28-
fn new(s: ~RtioTcpStreamObject) -> TcpStream {
25+
fn new(s: ~RtioTcpStream) -> TcpStream {
2926
TcpStream { obj: s }
3027
}
3128

@@ -142,7 +139,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener {
142139
}
143140

144141
pub struct TcpAcceptor {
145-
priv obj: ~RtioTcpAcceptorObject
142+
priv obj: ~RtioTcpAcceptor
146143
}
147144

148145
impl Acceptor<TcpStream> for TcpAcceptor {

branches/try2/src/libstd/rt/io/net/udp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use result::{Ok, Err};
1313
use rt::io::net::ip::SocketAddr;
1414
use rt::io::{Reader, Writer};
1515
use rt::io::{io_error, read_error, EndOfFile};
16-
use rt::rtio::{RtioSocket, RtioUdpSocketObject, RtioUdpSocket, IoFactory, IoFactoryObject};
16+
use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, IoFactoryObject};
1717
use rt::local::Local;
1818

1919
pub struct UdpSocket {
20-
priv obj: ~RtioUdpSocketObject
20+
priv obj: ~RtioUdpSocket
2121
}
2222

2323
impl UdpSocket {

branches/try2/src/libstd/rt/io/net/unix.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ instances as clients.
2525
use prelude::*;
2626

2727
use super::super::support::PathLike;
28-
use rt::rtio::{IoFactory, IoFactoryObject, RtioUnixListenerObject};
29-
use rt::rtio::{RtioUnixAcceptorObject, RtioPipeObject, RtioUnixListener};
30-
use rt::rtio::RtioUnixAcceptor;
28+
use rt::rtio::{IoFactory, IoFactoryObject, RtioUnixListener};
29+
use rt::rtio::{RtioUnixAcceptor, RtioPipe, RtioUnixListenerObject};
3130
use rt::io::pipe::PipeStream;
3231
use rt::io::{io_error, Listener, Acceptor, Reader, Writer};
3332
use rt::local::Local;
@@ -38,7 +37,7 @@ pub struct UnixStream {
3837
}
3938

4039
impl UnixStream {
41-
fn new(obj: ~RtioPipeObject) -> UnixStream {
40+
fn new(obj: ~RtioPipe) -> UnixStream {
4241
UnixStream { obj: PipeStream::new_bound(obj) }
4342
}
4443

@@ -141,7 +140,7 @@ impl Listener<UnixStream, UnixAcceptor> for UnixListener {
141140
}
142141

143142
pub struct UnixAcceptor {
144-
priv obj: ~RtioUnixAcceptorObject,
143+
priv obj: ~RtioUnixAcceptor,
145144
}
146145

147146
impl Acceptor<UnixStream> for UnixAcceptor {

branches/try2/src/libstd/rt/io/pipe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
use prelude::*;
1717
use super::{Reader, Writer};
1818
use rt::io::{io_error, read_error, EndOfFile};
19-
use rt::rtio::{RtioPipe, RtioPipeObject};
19+
use rt::rtio::RtioPipe;
2020

2121
pub struct PipeStream {
22-
priv obj: ~RtioPipeObject
22+
priv obj: ~RtioPipe,
2323
}
2424

2525
impl PipeStream {
26-
pub fn new_bound(inner: ~RtioPipeObject) -> PipeStream {
26+
pub fn new_bound(inner: ~RtioPipe) -> PipeStream {
2727
PipeStream { obj: inner }
2828
}
2929
}

branches/try2/src/libstd/rt/io/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use libc;
1616
use rt::io;
1717
use rt::io::io_error;
1818
use rt::local::Local;
19-
use rt::rtio::{RtioProcess, RtioProcessObject, IoFactoryObject, IoFactory};
19+
use rt::rtio::{RtioProcess, IoFactoryObject, IoFactory};
2020

2121
// windows values don't matter as long as they're at least one of unix's
2222
// TERM/KILL/INT signals
@@ -26,7 +26,7 @@ use rt::rtio::{RtioProcess, RtioProcessObject, IoFactoryObject, IoFactory};
2626
#[cfg(not(windows))] pub static MustDieSignal: int = libc::SIGKILL as int;
2727

2828
pub struct Process {
29-
priv handle: ~RtioProcessObject,
29+
priv handle: ~RtioProcess,
3030
io: ~[Option<io::PipeStream>],
3131
}
3232

branches/try2/src/libstd/rt/io/stdio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use libc;
1313
use option::{Option, Some, None};
1414
use result::{Ok, Err};
1515
use rt::local::Local;
16-
use rt::rtio::{IoFactoryObject, IoFactory, RtioTTYObject, RtioTTY};
16+
use rt::rtio::{IoFactoryObject, IoFactory, RtioTTY};
1717
use super::{Reader, Writer, io_error};
1818

1919
/// Creates a new non-blocking handle to the stdin of the current process.
@@ -87,7 +87,7 @@ pub fn println_args(fmt: &fmt::Arguments) {
8787

8888
/// Representation of a reader of a standard input stream
8989
pub struct StdReader {
90-
priv inner: ~RtioTTYObject
90+
priv inner: ~RtioTTY
9191
}
9292

9393
impl StdReader {
@@ -129,7 +129,7 @@ impl Reader for StdReader {
129129

130130
/// Representation of a writer to a standard output stream
131131
pub struct StdWriter {
132-
priv inner: ~RtioTTYObject
132+
priv inner: ~RtioTTY
133133
}
134134

135135
impl StdWriter {

branches/try2/src/libstd/rt/io/timer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
use option::{Option, Some, None};
1212
use result::{Ok, Err};
1313
use rt::io::{io_error};
14-
use rt::rtio::{IoFactory, IoFactoryObject,
15-
RtioTimer, RtioTimerObject};
14+
use rt::rtio::{IoFactory, IoFactoryObject, RtioTimer};
1615
use rt::local::Local;
1716

1817
pub struct Timer {
19-
priv obj: ~RtioTimerObject
18+
priv obj: ~RtioTimer
2019
}
2120

2221
/// Sleep the current task for `msecs` milliseconds.

branches/try2/src/libstd/rt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int {
279279
rtdebug!("inserting a regular scheduler");
280280

281281
// Every scheduler is driven by an I/O event loop.
282-
let loop_ = ~UvEventLoop::new();
282+
let loop_ = ~UvEventLoop::new() as ~rtio::EventLoop;
283283
let mut sched = ~Scheduler::new(loop_,
284284
work_queue.clone(),
285285
work_queues.clone(),
@@ -303,7 +303,7 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int {
303303
// set.
304304
let work_queue = WorkQueue::new();
305305

306-
let main_loop = ~UvEventLoop::new();
306+
let main_loop = ~UvEventLoop::new() as ~rtio::EventLoop;
307307
let mut main_sched = ~Scheduler::new_special(main_loop,
308308
work_queue,
309309
work_queues.clone(),

branches/try2/src/libstd/rt/rtio.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,18 @@ use super::io::support::PathLike;
2323
use super::io::{SeekStyle};
2424
use super::io::{FileMode, FileAccess, FileStat};
2525

26-
// XXX: ~object doesn't work currently so these are some placeholder
27-
// types to use instead
28-
pub type EventLoopObject = uvio::UvEventLoop;
29-
pub type RemoteCallbackObject = uvio::UvRemoteCallback;
30-
pub type IoFactoryObject = uvio::UvIoFactory;
31-
pub type RtioTcpStreamObject = uvio::UvTcpStream;
32-
pub type RtioTcpAcceptorObject = uvio::UvTcpAcceptor;
26+
// FIXME(#9893) cannot call by-value self method on a trait object
3327
pub type RtioTcpListenerObject = uvio::UvTcpListener;
34-
pub type RtioUdpSocketObject = uvio::UvUdpSocket;
35-
pub type RtioTimerObject = uvio::UvTimer;
36-
pub type PausibleIdleCallback = uvio::UvPausibleIdleCallback;
37-
pub type RtioPipeObject = uvio::UvPipeStream;
38-
pub type RtioProcessObject = uvio::UvProcess;
3928
pub type RtioUnixListenerObject = uvio::UvUnixListener;
40-
pub type RtioUnixAcceptorObject = uvio::UvUnixAcceptor;
41-
pub type RtioTTYObject = uvio::UvTTY;
4229

4330
pub trait EventLoop {
4431
fn run(&mut self);
4532
fn callback(&mut self, ~fn());
4633
fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback;
4734
fn callback_ms(&mut self, ms: u64, ~fn());
48-
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallbackObject;
35+
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallback;
4936
/// The asynchronous I/O services. Not all event loops may provide one
50-
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactoryObject>;
37+
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory>;
5138
}
5239

5340
pub trait RemoteCallback {
@@ -73,10 +60,10 @@ pub struct FileOpenConfig {
7360
}
7461

7562
pub trait IoFactory {
76-
fn tcp_connect(&mut self, addr: SocketAddr) -> Result<~RtioTcpStreamObject, IoError>;
63+
fn tcp_connect(&mut self, addr: SocketAddr) -> Result<~RtioTcpStream, IoError>;
7764
fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListenerObject, IoError>;
78-
fn udp_bind(&mut self, addr: SocketAddr) -> Result<~RtioUdpSocketObject, IoError>;
79-
fn timer_init(&mut self) -> Result<~RtioTimerObject, IoError>;
65+
fn udp_bind(&mut self, addr: SocketAddr) -> Result<~RtioUdpSocket, IoError>;
66+
fn timer_init(&mut self) -> Result<~RtioTimer, IoError>;
8067
fn fs_from_raw_fd(&mut self, fd: c_int, close_on_drop: bool) -> ~RtioFileStream;
8168
fn fs_open<P: PathLike>(&mut self, path: &P, fm: FileMode, fa: FileAccess)
8269
-> Result<~RtioFileStream, IoError>;
@@ -89,22 +76,22 @@ pub trait IoFactory {
8976
fn fs_readdir<P: PathLike>(&mut self, path: &P, flags: c_int) ->
9077
Result<~[Path], IoError>;
9178
fn spawn(&mut self, config: ProcessConfig)
92-
-> Result<(~RtioProcessObject, ~[Option<~RtioPipeObject>]), IoError>;
79+
-> Result<(~RtioProcess, ~[Option<~RtioPipe>]), IoError>;
9380

9481
fn unix_bind<P: PathLike>(&mut self, path: &P) ->
9582
Result<~RtioUnixListenerObject, IoError>;
9683
fn unix_connect<P: PathLike>(&mut self, path: &P) ->
97-
Result<~RtioPipeObject, IoError>;
84+
Result<~RtioPipe, IoError>;
9885
fn tty_open(&mut self, fd: c_int, readable: bool, close_on_drop: bool)
99-
-> Result<~RtioTTYObject, IoError>;
86+
-> Result<~RtioTTY, IoError>;
10087
}
10188

10289
pub trait RtioTcpListener : RtioSocket {
103-
fn listen(self) -> Result<~RtioTcpAcceptorObject, IoError>;
90+
fn listen(self) -> Result<~RtioTcpAcceptor, IoError>;
10491
}
10592

10693
pub trait RtioTcpAcceptor : RtioSocket {
107-
fn accept(&mut self) -> Result<~RtioTcpStreamObject, IoError>;
94+
fn accept(&mut self) -> Result<~RtioTcpStream, IoError>;
10895
fn accept_simultaneously(&mut self) -> Result<(), IoError>;
10996
fn dont_accept_simultaneously(&mut self) -> Result<(), IoError>;
11097
}
@@ -166,11 +153,11 @@ pub trait RtioPipe {
166153
}
167154

168155
pub trait RtioUnixListener {
169-
fn listen(self) -> Result<~RtioUnixAcceptorObject, IoError>;
156+
fn listen(self) -> Result<~RtioUnixAcceptor, IoError>;
170157
}
171158

172159
pub trait RtioUnixAcceptor {
173-
fn accept(&mut self) -> Result<~RtioPipeObject, IoError>;
160+
fn accept(&mut self) -> Result<~RtioPipe, IoError>;
174161
fn accept_simultaneously(&mut self) -> Result<(), IoError>;
175162
fn dont_accept_simultaneously(&mut self) -> Result<(), IoError>;
176163
}
@@ -182,3 +169,10 @@ pub trait RtioTTY {
182169
fn reset_mode(&mut self);
183170
fn get_winsize(&mut self) -> Result<(int, int), IoError>;
184171
}
172+
173+
pub trait PausibleIdleCallback {
174+
fn start(&mut self, f: ~fn());
175+
fn pause(&mut self);
176+
fn resume(&mut self);
177+
fn close(&mut self);
178+
}

branches/try2/src/libstd/rt/sched.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use unstable::raw;
1616
use super::sleeper_list::SleeperList;
1717
use super::work_queue::WorkQueue;
1818
use super::stack::{StackPool};
19-
use super::rtio::{EventLoop, EventLoopObject, RemoteCallbackObject};
19+
use super::rtio::EventLoop;
2020
use super::context::Context;
2121
use super::task::{Task, AnySched, Sched};
2222
use super::message_queue::MessageQueue;
@@ -63,7 +63,7 @@ pub struct Scheduler {
6363
no_sleep: bool,
6464
stack_pool: StackPool,
6565
/// The event loop used to drive the scheduler and perform I/O
66-
event_loop: ~EventLoopObject,
66+
event_loop: ~EventLoop,
6767
/// The scheduler runs on a special task. When it is not running
6868
/// it is stored here instead of the work queue.
6969
priv sched_task: Option<~Task>,
@@ -107,7 +107,7 @@ impl Scheduler {
107107

108108
// * Initialization Functions
109109

110-
pub fn new(event_loop: ~EventLoopObject,
110+
pub fn new(event_loop: ~EventLoop,
111111
work_queue: WorkQueue<~Task>,
112112
work_queues: ~[WorkQueue<~Task>],
113113
sleeper_list: SleeperList)
@@ -119,7 +119,7 @@ impl Scheduler {
119119

120120
}
121121

122-
pub fn new_special(event_loop: ~EventLoopObject,
122+
pub fn new_special(event_loop: ~EventLoop,
123123
work_queue: WorkQueue<~Task>,
124124
work_queues: ~[WorkQueue<~Task>],
125125
sleeper_list: SleeperList,
@@ -227,7 +227,7 @@ impl Scheduler {
227227
// mutable reference to the event_loop to give it the "run"
228228
// command.
229229
unsafe {
230-
let event_loop: *mut ~EventLoopObject = &mut self_sched.event_loop;
230+
let event_loop: *mut ~EventLoop = &mut self_sched.event_loop;
231231

232232
// Our scheduler must be in the task before the event loop
233233
// is started.
@@ -793,7 +793,7 @@ pub enum SchedMessage {
793793
}
794794

795795
pub struct SchedHandle {
796-
priv remote: ~RemoteCallbackObject,
796+
priv remote: ~RemoteCallback,
797797
priv queue: MessageQueue<SchedMessage>,
798798
sched_id: uint
799799
}

branches/try2/src/libstd/rt/test.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use super::io::net::ip::{SocketAddr, Ipv4Addr, Ipv6Addr};
2222
use vec::{OwnedVector, MutableVector, ImmutableVector};
2323
use path::GenericPath;
2424
use rt::sched::Scheduler;
25+
use rt::rtio::EventLoop;
2526
use unstable::{run_in_bare_thread};
2627
use rt::thread::Thread;
2728
use rt::task::Task;
@@ -36,7 +37,7 @@ pub fn new_test_uv_sched() -> Scheduler {
3637
let queue = WorkQueue::new();
3738
let queues = ~[queue.clone()];
3839

39-
let mut sched = Scheduler::new(~UvEventLoop::new(),
40+
let mut sched = Scheduler::new(~UvEventLoop::new() as ~EventLoop,
4041
queue,
4142
queues,
4243
SleeperList::new());
@@ -195,7 +196,7 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
195196
}
196197

197198
for i in range(0u, nthreads) {
198-
let loop_ = ~UvEventLoop::new();
199+
let loop_ = ~UvEventLoop::new() as ~EventLoop;
199200
let mut sched = ~Scheduler::new(loop_,
200201
work_queues[i].clone(),
201202
work_queues.clone(),

0 commit comments

Comments
 (0)