@@ -61,10 +61,7 @@ the loop's msg port
61
61
provided `async_handle`. `uv_run` should return shortly after
62
62
" ]
63
63
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 ) ) {
68
65
let loop_ptr = ll:: loop_new ( ) ;
69
66
// set up the special async handle we'll use to allow multi-task
70
67
// communication with this loop
@@ -77,8 +74,6 @@ unsafe fn run_high_level_loop(msg_po: port<high_level_msg>,
77
74
let data: hl_loop_data = {
78
75
async_handle: async_handle,
79
76
mut active: true ,
80
- before_msg_process: before_msg_process,
81
- before_tear_down: before_tear_down,
82
77
msg_po_ptr: addr_of ( msg_po)
83
78
} ;
84
79
ll:: set_data_for_uv_handle ( async_handle, addr_of ( data) ) ;
@@ -130,8 +125,6 @@ fn exit(hl_loop: high_level_loop) unsafe {
130
125
type hl_loop_data = {
131
126
async_handle : * ll:: uv_async_t ,
132
127
mut active : bool ,
133
- before_msg_process : fn ~( * ll:: uv_async_t , bool ) -> bool ,
134
- before_tear_down : fn ~( * ll:: uv_async_t ) ,
135
128
msg_po_ptr : * port < high_level_msg >
136
129
} ;
137
130
@@ -160,8 +153,6 @@ crust fn high_level_wake_up_cb(async_handle: *ll::uv_async_t,
160
153
if ( * data) . active {
161
154
alt msg {
162
155
interaction( cb) {
163
- ( * data) . before_msg_process ( async_handle,
164
- ( * data) . active ) ;
165
156
cb ( loop_ptr) ;
166
157
}
167
158
teardown_loop {
@@ -189,7 +180,6 @@ fn begin_teardown(data: *hl_loop_data) unsafe {
189
180
log ( debug, "high_level_tear_down() called, close async_handle" ) ;
190
181
// call user-suppled before_tear_down cb
191
182
let async_handle = ( * data) . async_handle ;
192
- ( * data) . before_tear_down ( async_handle) ;
193
183
ll:: close ( async_handle as * c_void , tear_down_close_cb) ;
194
184
}
195
185
@@ -236,30 +226,16 @@ mod test {
236
226
task:: spawn_sched ( task:: manual_threads ( 1 u) ) { ||
237
227
let msg_po = comm:: port :: < high_level_msg > ( ) ;
238
228
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
+ }
263
239
comm:: send ( exit_ch, ( ) ) ;
264
240
} ;
265
241
ret comm:: recv ( hl_loop_port) ;
0 commit comments