Skip to content

Commit 6c4200c

Browse files
committed
---
yaml --- r: 146537 b: refs/heads/try2 c: 1bdaea8 h: refs/heads/master i: 146535: 15fa9cd v: v3
1 parent de07928 commit 6c4200c

File tree

5 files changed

+15
-33
lines changed

5 files changed

+15
-33
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: f9abd998d6a5368c54162deb0bf187e94e31dc27
8+
refs/heads/try2: 1bdaea827ed957ce404fffee27923e9606584ce0
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustuv/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
313313
impl Drop for TcpWatcher {
314314
fn drop(&mut self) {
315315
let _m = self.fire_missiles();
316-
self.stream.close(true);
316+
self.stream.close();
317317
}
318318
}
319319

branches/try2/src/librustuv/pipe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl HomingIO for PipeWatcher {
136136
impl Drop for PipeWatcher {
137137
fn drop(&mut self) {
138138
let _m = self.fire_missiles();
139-
self.stream.close(true); // close synchronously
139+
self.stream.close();
140140
}
141141
}
142142

branches/try2/src/librustuv/stream.rs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use std::cast;
1212
use std::libc::{c_int, size_t, ssize_t, c_void};
13-
use std::ptr;
1413
use std::rt::BlockedTask;
1514
use std::rt::local::Local;
1615
use std::rt::sched::Scheduler;
@@ -124,35 +123,23 @@ impl StreamWatcher {
124123

125124
// This will deallocate an internally used memory, along with closing the
126125
// handle (and freeing it).
127-
//
128-
// The `synchronous` flag dictates whether this handle is closed
129-
// synchronously (the task is blocked) or asynchronously (the task is not
130-
// block, but the handle is still deallocated).
131-
pub fn close(&mut self, synchronous: bool) {
132-
if synchronous {
133-
let mut closing_task = None;
134-
unsafe {
135-
uvll::set_data_for_uv_handle(self.handle, &closing_task);
136-
}
126+
pub fn close(&mut self) {
127+
let mut closing_task = None;
128+
unsafe {
129+
uvll::set_data_for_uv_handle(self.handle, &closing_task);
130+
}
137131

138-
// Wait for this stream to close because it possibly represents a remote
139-
// connection which may have consequences if we close asynchronously.
140-
let sched: ~Scheduler = Local::take();
141-
do sched.deschedule_running_task_and_then |_, task| {
142-
closing_task = Some(task);
143-
unsafe { uvll::uv_close(self.handle, close_cb) }
144-
}
145-
} else {
146-
unsafe {
147-
uvll::set_data_for_uv_handle(self.handle, ptr::null::<u8>());
148-
uvll::uv_close(self.handle, close_cb)
149-
}
132+
// Wait for this stream to close because it possibly represents a remote
133+
// connection which may have consequences if we close asynchronously.
134+
let sched: ~Scheduler = Local::take();
135+
do sched.deschedule_running_task_and_then |_, task| {
136+
closing_task = Some(task);
137+
unsafe { uvll::uv_close(self.handle, close_cb) }
150138
}
151139

152140
extern fn close_cb(handle: *uvll::uv_handle_t) {
153141
let data: *c_void = unsafe { uvll::get_data_for_uv_handle(handle) };
154142
unsafe { uvll::free_handle(handle) }
155-
if data.is_null() { return }
156143

157144
let closing_task: &mut Option<BlockedTask> = unsafe {
158145
cast::transmute(data)

branches/try2/src/librustuv/tty.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,8 @@ impl HomingIO for TtyWatcher {
101101
}
102102

103103
impl Drop for TtyWatcher {
104-
// TTY handles are used for the logger in a task, so this destructor is run
105-
// when a task is destroyed. When a task is being destroyed, a local
106-
// scheduler isn't available, so we can't do the normal "take the scheduler
107-
// and resume once close is done". Instead close operations on a TTY are
108-
// asynchronous.
109104
fn drop(&mut self) {
110105
let _m = self.fire_missiles();
111-
self.stream.close(false);
106+
self.stream.close();
112107
}
113108
}

0 commit comments

Comments
 (0)