Skip to content

Commit 623acaa

Browse files
committed
std: Remove unused args from run_high_level_loop
1 parent 444ff68 commit 623acaa

File tree

2 files changed

+19
-58
lines changed

2 files changed

+19
-58
lines changed

src/libstd/uv_global_loop.rs

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -103,29 +103,14 @@ fn spawn_high_level_loop() -> hl::high_level_loop unsafe {
103103
#debug("global libuv task is now weak %?", weak_exit_po);
104104
let loop_msg_po = port::<hl::high_level_msg>();
105105
let loop_msg_ch = loop_msg_po.chan();
106-
hl::run_high_level_loop(
107-
loop_msg_po,
108-
// before_run
109-
{|async_handle|
110-
#debug("global libuv: before_run %?", async_handle);
111-
let hll = hl::high_level_loop({
112-
async_handle: async_handle,
113-
op_chan: loop_msg_ch
114-
});
115-
exit_ch.send(hll);
116-
},
117-
// before_msg_process
118-
{|async_handle, loop_active|
119-
#debug("global libuv: before_msg_drain %? %?",
120-
async_handle, loop_active);
121-
true
122-
},
123-
// before_tear_down
124-
{|async_handle|
125-
#debug("libuv task: before_tear_down %?",
126-
async_handle);
127-
}
128-
);
106+
hl::run_high_level_loop(loop_msg_po) {|async_handle|
107+
#debug("global libuv: before_run %?", async_handle);
108+
let hll = hl::high_level_loop({
109+
async_handle: async_handle,
110+
op_chan: loop_msg_ch
111+
});
112+
exit_ch.send(hll);
113+
}
129114
#debug("global libuv task is leaving weakened state");
130115
};
131116
#debug("global libuv task exiting");

src/libstd/uv_hl.rs

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ the loop's msg port
6161
provided `async_handle`. `uv_run` should return shortly after
6262
"]
6363
unsafe fn run_high_level_loop(msg_po: port<high_level_msg>,
64-
before_run: fn~(*ll::uv_async_t),
65-
before_msg_process:
66-
fn~(*ll::uv_async_t, bool) -> bool,
67-
before_tear_down: fn~(*ll::uv_async_t)) {
64+
before_run: fn~(*ll::uv_async_t)) {
6865
let loop_ptr = ll::loop_new();
6966
// set up the special async handle we'll use to allow multi-task
7067
// communication with this loop
@@ -77,8 +74,6 @@ unsafe fn run_high_level_loop(msg_po: port<high_level_msg>,
7774
let data: hl_loop_data = {
7875
async_handle: async_handle,
7976
mut active: true,
80-
before_msg_process: before_msg_process,
81-
before_tear_down: before_tear_down,
8277
msg_po_ptr: addr_of(msg_po)
8378
};
8479
ll::set_data_for_uv_handle(async_handle, addr_of(data));
@@ -130,8 +125,6 @@ fn exit(hl_loop: high_level_loop) unsafe {
130125
type hl_loop_data = {
131126
async_handle: *ll::uv_async_t,
132127
mut active: bool,
133-
before_msg_process: fn~(*ll::uv_async_t, bool) -> bool,
134-
before_tear_down: fn~(*ll::uv_async_t),
135128
msg_po_ptr: *port<high_level_msg>
136129
};
137130

@@ -160,8 +153,6 @@ crust fn high_level_wake_up_cb(async_handle: *ll::uv_async_t,
160153
if (*data).active {
161154
alt msg {
162155
interaction(cb) {
163-
(*data).before_msg_process(async_handle,
164-
(*data).active);
165156
cb(loop_ptr);
166157
}
167158
teardown_loop {
@@ -189,7 +180,6 @@ fn begin_teardown(data: *hl_loop_data) unsafe {
189180
log(debug, "high_level_tear_down() called, close async_handle");
190181
// call user-suppled before_tear_down cb
191182
let async_handle = (*data).async_handle;
192-
(*data).before_tear_down(async_handle);
193183
ll::close(async_handle as *c_void, tear_down_close_cb);
194184
}
195185

@@ -236,30 +226,16 @@ mod test {
236226
task::spawn_sched(task::manual_threads(1u)) {||
237227
let msg_po = comm::port::<high_level_msg>();
238228
let msg_ch = comm::chan(msg_po);
239-
run_high_level_loop(
240-
msg_po,
241-
// before_run
242-
{|async_handle|
243-
log(debug,#fmt("hltest before_run: async_handle %?",
244-
async_handle));
245-
// do an async_send with it
246-
ll::async_send(async_handle);
247-
comm::send(hl_loop_ch, high_level_loop({
248-
async_handle: async_handle,
249-
op_chan: msg_ch
250-
}));
251-
},
252-
// before_msg_drain
253-
{|async_handle, status|
254-
log(debug,#fmt("hltest before_msg_drain: handle %? %?",
255-
async_handle, status));
256-
true
257-
},
258-
// before_tear_down
259-
{|async_handle|
260-
log(debug,#fmt("hl test_loop b4_tear_down: async %?",
261-
async_handle));
262-
});
229+
run_high_level_loop(msg_po) {|async_handle|
230+
log(debug,#fmt("hltest before_run: async_handle %?",
231+
async_handle));
232+
// do an async_send with it
233+
ll::async_send(async_handle);
234+
comm::send(hl_loop_ch, high_level_loop({
235+
async_handle: async_handle,
236+
op_chan: msg_ch
237+
}));
238+
}
263239
comm::send(exit_ch, ());
264240
};
265241
ret comm::recv(hl_loop_port);

0 commit comments

Comments
 (0)