Skip to content

Commit 687cfec

Browse files
committed
---
yaml --- r: 95989 b: refs/heads/dist-snap c: 6690bcb h: refs/heads/master i: 95987: c1f9beb v: v3
1 parent ba015c6 commit 687cfec

File tree

10 files changed

+92
-145
lines changed

10 files changed

+92
-145
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 18ce014e9d99a66690e9db02e799f57ab969f36d
9+
refs/heads/dist-snap: 6690bcb10178b08c56ad56b111e4dcb7e0e06b36
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustuv/async.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl AsyncWatcher {
3535
pub fn new(loop_: &mut Loop, cb: ~Callback) -> AsyncWatcher {
3636
let handle = UvHandle::alloc(None::<AsyncWatcher>, uvll::UV_ASYNC);
3737
assert_eq!(unsafe {
38-
uvll::async_init(loop_.native_handle(), handle, async_cb)
38+
uvll::uv_async_init(loop_.native_handle(), handle, async_cb)
3939
}, 0);
4040
let flag = Exclusive::new(false);
4141
let payload = ~Payload { callback: cb, exit_flag: flag.clone() };
@@ -49,7 +49,7 @@ impl AsyncWatcher {
4949

5050
impl UvHandle<uvll::uv_async_t> for AsyncWatcher {
5151
fn uv_handle(&self) -> *uvll::uv_async_t { self.handle }
52-
unsafe fn from_uv_handle<'a>(h: &'a *T) -> &'a mut AsyncWatcher {
52+
unsafe fn from_uv_handle<'a>(_: &'a *uvll::uv_async_t) -> &'a mut AsyncWatcher {
5353
fail!("async watchers can't be built from their handles");
5454
}
5555
}
@@ -89,7 +89,7 @@ extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
8989
payload.callback.call();
9090

9191
if should_exit {
92-
unsafe { uvll::close(handle, close_cb) }
92+
unsafe { uvll::uv_close(handle, close_cb) }
9393
}
9494
}
9595

@@ -104,7 +104,7 @@ extern fn close_cb(handle: *uvll::uv_handle_t) {
104104

105105
impl RemoteCallback for AsyncWatcher {
106106
fn fire(&mut self) {
107-
unsafe { uvll::async_send(self.handle) }
107+
unsafe { uvll::uv_async_send(self.handle) }
108108
}
109109
}
110110

@@ -117,7 +117,7 @@ impl Drop for AsyncWatcher {
117117
// signal and see the exit flag, destroying the handle
118118
// before the final send.
119119
*should_exit = true;
120-
uvll::async_send(self.handle)
120+
uvll::uv_async_send(self.handle)
121121
}
122122
}
123123
}

branches/dist-snap/src/librustuv/file.rs

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::c_str;
1313
use std::c_str::CString;
1414
use std::cast::transmute;
1515
use std::libc;
16-
use std::libc::{c_int, c_char, c_void};
16+
use std::libc::{c_int, c_char, c_void, c_uint};
1717

1818
use super::{Request, NativeHandle, Loop, FsCallback, Buf,
1919
status_to_maybe_uv_error, UvError};
@@ -147,25 +147,12 @@ impl FsRequest {
147147
self.sync_cleanup(result)
148148
}
149149

150-
<<<<<<< HEAD
151150
pub fn close(mut self, loop_: &Loop, fd: c_int, cb: FsCallback) {
152151
let complete_cb_ptr = self.req_boilerplate(Some(cb));
153152
assert_eq!(unsafe {
154-
uvll::fs_close(loop_.native_handle(), self.native_handle(),
155-
fd, complete_cb_ptr)
156-
}, 0);
157-
=======
158-
pub fn close(self, loop_: &Loop, fd: c_int, cb: FsCallback) {
159-
let complete_cb_ptr = {
160-
let mut me = self;
161-
me.req_boilerplate(Some(cb))
162-
};
163-
let ret = unsafe {
164153
uvll::uv_fs_close(loop_.native_handle(), self.native_handle(),
165154
fd, complete_cb_ptr)
166-
};
167-
assert_eq!(ret, 0);
168-
>>>>>>> 1850d26... Remove lots of uv/C++ wrappers
155+
}, 0);
169156
}
170157
pub fn close_sync(mut self, loop_: &Loop,
171158
fd: c_int) -> Result<c_int, UvError> {
@@ -177,77 +164,50 @@ impl FsRequest {
177164
self.sync_cleanup(result)
178165
}
179166

180-
<<<<<<< HEAD
181167
pub fn mkdir(mut self, loop_: &Loop, path: &CString, mode: c_int,
182168
cb: FsCallback) {
183169
let complete_cb_ptr = self.req_boilerplate(Some(cb));
184170
assert_eq!(path.with_ref(|p| unsafe {
185-
uvll::fs_mkdir(loop_.native_handle(),
186-
self.native_handle(), p, mode, complete_cb_ptr)
171+
uvll::uv_fs_mkdir(loop_.native_handle(),
172+
self.native_handle(), p, mode, complete_cb_ptr)
187173
}), 0);
188174
}
189175

190176
pub fn rmdir(mut self, loop_: &Loop, path: &CString, cb: FsCallback) {
191177
let complete_cb_ptr = self.req_boilerplate(Some(cb));
192178
assert_eq!(path.with_ref(|p| unsafe {
193-
uvll::fs_rmdir(loop_.native_handle(),
194-
self.native_handle(), p, complete_cb_ptr)
179+
uvll::uv_fs_rmdir(loop_.native_handle(),
180+
self.native_handle(), p, complete_cb_ptr)
195181
}), 0);
196182
}
197183

198184
pub fn rename(mut self, loop_: &Loop, path: &CString, to: &CString,
199185
cb: FsCallback) {
200186
let complete_cb_ptr = self.req_boilerplate(Some(cb));
201187
assert_eq!(unsafe {
202-
uvll::fs_rename(loop_.native_handle(),
203-
self.native_handle(),
204-
path.with_ref(|p| p),
205-
to.with_ref(|p| p),
206-
complete_cb_ptr)
188+
uvll::uv_fs_rename(loop_.native_handle(),
189+
self.native_handle(),
190+
path.with_ref(|p| p),
191+
to.with_ref(|p| p),
192+
complete_cb_ptr)
207193
}, 0);
208194
}
209195

210196
pub fn chmod(mut self, loop_: &Loop, path: &CString, mode: c_int,
211197
cb: FsCallback) {
212198
let complete_cb_ptr = self.req_boilerplate(Some(cb));
213199
assert_eq!(path.with_ref(|p| unsafe {
214-
uvll::fs_chmod(loop_.native_handle(), self.native_handle(), p, mode,
215-
complete_cb_ptr)
200+
uvll::uv_fs_chmod(loop_.native_handle(), self.native_handle(), p,
201+
mode, complete_cb_ptr)
216202
}), 0);
217-
=======
218-
pub fn mkdir(self, loop_: &Loop, path: &CString, mode: int, cb: FsCallback) {
219-
let complete_cb_ptr = {
220-
let mut me = self;
221-
me.req_boilerplate(Some(cb))
222-
};
223-
let ret = path.with_ref(|p| unsafe {
224-
uvll::uv_fs_mkdir(loop_.native_handle(),
225-
self.native_handle(), p,
226-
mode as c_int, complete_cb_ptr)
227-
});
228-
assert_eq!(ret, 0);
229-
}
230-
231-
pub fn rmdir(self, loop_: &Loop, path: &CString, cb: FsCallback) {
232-
let complete_cb_ptr = {
233-
let mut me = self;
234-
me.req_boilerplate(Some(cb))
235-
};
236-
let ret = path.with_ref(|p| unsafe {
237-
uvll::uv_fs_rmdir(loop_.native_handle(),
238-
self.native_handle(), p, complete_cb_ptr)
239-
});
240-
assert_eq!(ret, 0);
241-
>>>>>>> 1850d26... Remove lots of uv/C++ wrappers
242203
}
243204

244205
pub fn readdir(mut self, loop_: &Loop, path: &CString,
245206
flags: c_int, cb: FsCallback) {
246-
<<<<<<< HEAD
247207
let complete_cb_ptr = self.req_boilerplate(Some(cb));
248208
assert_eq!(path.with_ref(|p| unsafe {
249-
uvll::fs_readdir(loop_.native_handle(),
250-
self.native_handle(), p, flags, complete_cb_ptr)
209+
uvll::uv_fs_readdir(loop_.native_handle(),
210+
self.native_handle(), p, flags, complete_cb_ptr)
251211
}), 0);
252212
}
253213

@@ -318,17 +278,6 @@ impl FsRequest {
318278
uvll::uv_fs_fdatasync(loop_.native_handle(), self.native_handle(), fd,
319279
complete_cb_ptr)
320280
}, 0);
321-
=======
322-
let complete_cb_ptr = {
323-
let mut me = self;
324-
me.req_boilerplate(Some(cb))
325-
};
326-
let ret = path.with_ref(|p| unsafe {
327-
uvll::uv_fs_readdir(loop_.native_handle(),
328-
self.native_handle(), p, flags, complete_cb_ptr)
329-
});
330-
assert_eq!(ret, 0);
331-
>>>>>>> 1850d26... Remove lots of uv/C++ wrappers
332281
}
333282

334283
// accessors/utility funcs

branches/dist-snap/src/librustuv/idle.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl IdleWatcher {
2626
pub fn new(loop_: &mut Loop) -> ~IdleWatcher {
2727
let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
2828
assert_eq!(unsafe {
29-
uvll::idle_init(loop_.native_handle(), handle)
29+
uvll::uv_idle_init(loop_.native_handle(), handle)
3030
}, 0);
3131
let me = ~IdleWatcher {
3232
handle: handle,
@@ -40,10 +40,10 @@ impl IdleWatcher {
4040
pub fn onetime(loop_: &mut Loop, f: proc()) {
4141
let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
4242
unsafe {
43-
assert_eq!(uvll::idle_init(loop_.native_handle(), handle), 0);
43+
assert_eq!(uvll::uv_idle_init(loop_.native_handle(), handle), 0);
4444
let data: *c_void = cast::transmute(~f);
4545
uvll::set_data_for_uv_handle(handle, data);
46-
assert_eq!(uvll::idle_start(handle, onetime_cb), 0)
46+
assert_eq!(uvll::uv_idle_start(handle, onetime_cb), 0)
4747
}
4848

4949
extern fn onetime_cb(handle: *uvll::uv_idle_t, status: c_int) {
@@ -52,8 +52,8 @@ impl IdleWatcher {
5252
let data = uvll::get_data_for_uv_handle(handle);
5353
let f: ~proc() = cast::transmute(data);
5454
(*f)();
55-
uvll::idle_stop(handle);
56-
uvll::close(handle, close_cb);
55+
uvll::uv_idle_stop(handle);
56+
uvll::uv_close(handle, close_cb);
5757
}
5858
}
5959

@@ -67,18 +67,18 @@ impl PausibleIdleCallback for IdleWatcher {
6767
fn start(&mut self, cb: ~Callback) {
6868
assert!(self.callback.is_none());
6969
self.callback = Some(cb);
70-
assert_eq!(unsafe { uvll::idle_start(self.handle, idle_cb) }, 0)
70+
assert_eq!(unsafe { uvll::uv_idle_start(self.handle, idle_cb) }, 0)
7171
self.idle_flag = true;
7272
}
7373
fn pause(&mut self) {
7474
if self.idle_flag == true {
75-
assert_eq!(unsafe {uvll::idle_stop(self.handle) }, 0);
75+
assert_eq!(unsafe {uvll::uv_idle_stop(self.handle) }, 0);
7676
self.idle_flag = false;
7777
}
7878
}
7979
fn resume(&mut self) {
8080
if self.idle_flag == false {
81-
assert_eq!(unsafe { uvll::idle_start(self.handle, idle_cb) }, 0)
81+
assert_eq!(unsafe { uvll::uv_idle_start(self.handle, idle_cb) }, 0)
8282
self.idle_flag = true;
8383
}
8484
}

branches/dist-snap/src/librustuv/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use std::str::raw::from_c_str;
5050
use std::vec;
5151
use std::ptr;
5252
use std::str;
53-
use std::libc::{c_void, c_int, size_t, malloc, free, c_char, c_uint};
53+
use std::libc::{c_void, c_int, size_t, malloc, free};
5454
use std::cast::transmute;
5555
use std::ptr::null;
5656
use std::unstable::finally::Finally;
@@ -153,7 +153,7 @@ pub trait UvHandle<T> {
153153

154154
unsafe {
155155
uvll::set_data_for_uv_handle(self.uv_handle(), null::<()>());
156-
uvll::close(self.uv_handle(), close_cb)
156+
uvll::uv_close(self.uv_handle() as *uvll::uv_handle_t, close_cb)
157157
}
158158
}
159159
}

branches/dist-snap/src/librustuv/process.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,32 +201,30 @@ impl RtioProcess for Process {
201201
}
202202

203203
fn kill(&mut self, signal: int) -> Result<(), IoError> {
204-
do self.home_for_io |self_| {
205-
match unsafe {
206-
uvll::process_kill(self_.handle, signal as libc::c_int)
207-
} {
208-
0 => Ok(()),
209-
err => Err(uv_error_to_io_error(UvError(err)))
210-
}
204+
let _m = self.fire_missiles();
205+
match unsafe {
206+
uvll::uv_process_kill(self.handle, signal as libc::c_int)
207+
} {
208+
0 => Ok(()),
209+
err => Err(uv_error_to_io_error(UvError(err)))
211210
}
212211
}
213212

214213
fn wait(&mut self) -> int {
215214
// Make sure (on the home scheduler) that we have an exit status listed
216-
do self.home_for_io |self_| {
217-
match self_.exit_status {
218-
Some(*) => {}
219-
None => {
220-
// If there's no exit code previously listed, then the
221-
// process's exit callback has yet to be invoked. We just
222-
// need to deschedule ourselves and wait to be reawoken.
223-
let scheduler: ~Scheduler = Local::take();
224-
do scheduler.deschedule_running_task_and_then |_, task| {
225-
assert!(self_.to_wake.is_none());
226-
self_.to_wake = Some(task);
227-
}
228-
assert!(self_.exit_status.is_some());
215+
let _m = self.fire_missiles();
216+
match self.exit_status {
217+
Some(*) => {}
218+
None => {
219+
// If there's no exit code previously listed, then the
220+
// process's exit callback has yet to be invoked. We just
221+
// need to deschedule ourselves and wait to be reawoken.
222+
let scheduler: ~Scheduler = Local::take();
223+
do scheduler.deschedule_running_task_and_then |_, task| {
224+
assert!(self.to_wake.is_none());
225+
self.to_wake = Some(task);
229226
}
227+
assert!(self.exit_status.is_some());
230228
}
231229
}
232230

@@ -237,9 +235,8 @@ impl RtioProcess for Process {
237235

238236
impl Drop for Process {
239237
fn drop(&mut self) {
240-
do self.home_for_io |self_| {
241-
assert!(self_.to_wake.is_none());
242-
self_.close_async_();
243-
}
238+
let _m = self.fire_missiles();
239+
assert!(self.to_wake.is_none());
240+
self.close_async_();
244241
}
245242
}

branches/dist-snap/src/librustuv/signal.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ impl SignalWatcher {
3232
channel: SharedChan<Signum>) -> Result<~SignalWatcher, UvError> {
3333
let handle = UvHandle::alloc(None::<SignalWatcher>, uvll::UV_SIGNAL);
3434
assert_eq!(unsafe {
35-
uvll::signal_init(loop_.native_handle(), handle)
35+
uvll::uv_signal_init(loop_.native_handle(), handle)
3636
}, 0);
3737

38-
match unsafe { uvll::signal_start(handle, signal_cb, signum as c_int) } {
38+
match unsafe { uvll::uv_signal_start(handle, signal_cb, signum as c_int) } {
3939
0 => {
4040
let s = ~SignalWatcher {
4141
handle: handle,
@@ -72,8 +72,7 @@ impl RtioSignal for SignalWatcher {}
7272

7373
impl Drop for SignalWatcher {
7474
fn drop(&mut self) {
75-
do self.home_for_io |self_| {
76-
self_.close_async_();
77-
}
75+
let _m = self.fire_missiles();
76+
self.close_async_();
7877
}
7978
}

0 commit comments

Comments
 (0)