std: Remove unused iotask field `active`

This commit is contained in:
Brian Anderson 2012-05-24 23:59:25 -07:00
parent 81b8e20f31
commit 937ef188e3
1 changed files with 17 additions and 28 deletions

View File

@ -114,7 +114,6 @@ fn run_loop(iotask_ch: chan<iotask>) unsafe {
// initialize our loop data and store it in the loop
let data: iotask_loop_data = {
async_handle: async_handle,
mut active: true,
msg_po_ptr: addr_of(msg_po)
};
ll::set_data_for_uv_handle(async_handle, addr_of(data));
@ -137,7 +136,6 @@ fn run_loop(iotask_ch: chan<iotask>) unsafe {
// data that lives for the lifetime of the high-evel oo
type iotask_loop_data = {
async_handle: *ll::uv_async_t,
mut active: bool,
msg_po_ptr: *port<iotask_msg>
};
@ -158,29 +156,27 @@ crust fn wake_up_cb(async_handle: *ll::uv_async_t,
async_handle, status));
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
let data = ll::get_data_for_uv_handle(async_handle) as *iotask_loop_data;
// FIXME: What is this checking?
if (*data).active {
let msg_po = *((*data).msg_po_ptr);
while msg_po.peek() {
let msg = msg_po.recv();
if (*data).active {
alt msg {
interaction(cb) {
cb(loop_ptr);
}
teardown_loop {
begin_teardown(data);
}
}
} else {
// FIXME: drop msg ?
}
let msg_po = *((*data).msg_po_ptr);
while msg_po.peek() {
let msg = msg_po.recv();
alt msg {
interaction(cb) {
cb(loop_ptr);
}
teardown_loop {
begin_teardown(data);
}
}
} else {
// loop not active
}
}
fn begin_teardown(data: *iotask_loop_data) unsafe {
log(debug, "iotask begin_teardown() called, close async_handle");
// call user-suppled before_tear_down cb
let async_handle = (*data).async_handle;
ll::close(async_handle as *c_void, tear_down_close_cb);
}
crust fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
let loop_ptr = ll::get_loop_for_uv_handle(handle);
let loop_refs = ll::loop_refcount(loop_ptr);
@ -189,13 +185,6 @@ crust fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
assert loop_refs == 1i32;
}
fn begin_teardown(data: *iotask_loop_data) unsafe {
log(debug, "iotask begin_teardown() called, close async_handle");
// call user-suppled before_tear_down cb
let async_handle = (*data).async_handle;
ll::close(async_handle as *c_void, tear_down_close_cb);
}
#[cfg(test)]
mod test {
crust fn async_close_cb(handle: *ll::uv_async_t) unsafe {