Stop using oldcomm in uv_global_loop tests
This commit is contained in:
parent
bc0c5bb447
commit
19aa88cd64
1 changed files with 18 additions and 17 deletions
|
@ -126,15 +126,17 @@ mod test {
|
|||
|
||||
use core::iter;
|
||||
use core::libc;
|
||||
use core::oldcomm;
|
||||
use core::ptr;
|
||||
use core::task;
|
||||
use core::cast::transmute;
|
||||
use core::libc::c_void;
|
||||
use core::pipes::{stream, SharedChan, Chan};
|
||||
|
||||
extern fn simple_timer_close_cb(timer_ptr: *ll::uv_timer_t) unsafe {
|
||||
let exit_ch_ptr = ll::get_data_for_uv_handle(
|
||||
timer_ptr as *libc::c_void) as *oldcomm::Chan<bool>;
|
||||
let exit_ch = *exit_ch_ptr;
|
||||
oldcomm::send(exit_ch, true);
|
||||
timer_ptr as *libc::c_void);
|
||||
let exit_ch = transmute::<*c_void, ~Chan<bool>>(exit_ch_ptr);
|
||||
exit_ch.send(true);
|
||||
log(debug, fmt!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
|
||||
exit_ch_ptr));
|
||||
}
|
||||
|
@ -153,9 +155,8 @@ mod test {
|
|||
}
|
||||
|
||||
fn impl_uv_hl_simple_timer(iotask: &IoTask) unsafe {
|
||||
let exit_po = oldcomm::Port::<bool>();
|
||||
let exit_ch = oldcomm::Chan(&exit_po);
|
||||
let exit_ch_ptr = ptr::addr_of(&exit_ch);
|
||||
let (exit_po, exit_ch) = stream::<bool>();
|
||||
let exit_ch_ptr: *libc::c_void = transmute(~exit_ch);
|
||||
log(debug, fmt!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
|
||||
exit_ch_ptr));
|
||||
let timer_handle = ll::timer_t();
|
||||
|
@ -166,7 +167,7 @@ mod test {
|
|||
if(init_status == 0i32) {
|
||||
ll::set_data_for_uv_handle(
|
||||
timer_ptr as *libc::c_void,
|
||||
exit_ch_ptr as *libc::c_void);
|
||||
exit_ch_ptr);
|
||||
let start_status = ll::timer_start(timer_ptr, simple_timer_cb,
|
||||
1u, 0u);
|
||||
if(start_status == 0i32) {
|
||||
|
@ -179,22 +180,21 @@ mod test {
|
|||
fail ~"failure on ll::timer_init()";
|
||||
}
|
||||
};
|
||||
oldcomm::recv(exit_po);
|
||||
exit_po.recv();
|
||||
log(debug, ~"global_loop timer test: msg recv on exit_po, done..");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gl_uv_global_loop_high_level_global_timer() unsafe {
|
||||
let hl_loop = &get_gl();
|
||||
let exit_po = oldcomm::Port::<()>();
|
||||
let exit_ch = oldcomm::Chan(&exit_po);
|
||||
let (exit_po, exit_ch) = stream::<()>();
|
||||
task::spawn_sched(task::ManualThreads(1u), || {
|
||||
let hl_loop = &get_gl();
|
||||
impl_uv_hl_simple_timer(hl_loop);
|
||||
oldcomm::send(exit_ch, ());
|
||||
exit_ch.send(());
|
||||
});
|
||||
impl_uv_hl_simple_timer(hl_loop);
|
||||
oldcomm::recv(exit_po);
|
||||
exit_po.recv();
|
||||
}
|
||||
|
||||
// keeping this test ignored until some kind of stress-test-harness
|
||||
|
@ -202,18 +202,19 @@ mod test {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_stress_gl_uv_global_loop_high_level_global_timer() unsafe {
|
||||
let exit_po = oldcomm::Port::<()>();
|
||||
let exit_ch = oldcomm::Chan(&exit_po);
|
||||
let (exit_po, exit_ch) = stream::<()>();
|
||||
let exit_ch = SharedChan(exit_ch);
|
||||
let cycles = 5000u;
|
||||
for iter::repeat(cycles) {
|
||||
let exit_ch_clone = exit_ch.clone();
|
||||
task::spawn_sched(task::ManualThreads(1u), || {
|
||||
let hl_loop = &get_gl();
|
||||
impl_uv_hl_simple_timer(hl_loop);
|
||||
oldcomm::send(exit_ch, ());
|
||||
exit_ch_clone.send(());
|
||||
});
|
||||
};
|
||||
for iter::repeat(cycles) {
|
||||
oldcomm::recv(exit_po);
|
||||
exit_po.recv();
|
||||
};
|
||||
log(debug, ~"test_stress_gl_uv_global_loop_high_level_global_timer"+
|
||||
~" exiting sucessfully!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue