From e0f110aa12f7f5f99333b69b541a569e2a1d4041 Mon Sep 17 00:00:00 2001 From: Jeff Olson Date: Mon, 16 Apr 2012 15:29:07 -0700 Subject: [PATCH] clean and trying the global loop test as two separate loop lifetimes.. .. seeing an occasional valgrind/barf spew on some invalid read/writes.. need to investigate further.. i think its related to my poor citizen conduct, re: pointers stashed in rust_kernel.. --- src/libstd/uv_hl.rs | 16 +++++++++++----- src/rt/rust_kernel.cpp | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libstd/uv_hl.rs b/src/libstd/uv_hl.rs index f72471dff66..f9b761073ca 100644 --- a/src/libstd/uv_hl.rs +++ b/src/libstd/uv_hl.rs @@ -112,7 +112,7 @@ unsafe fn run_high_level_loop(loop_ptr: *libc::c_void, let async_handle = ptr::addr_of(async); // associate the async handle with the loop ll::async_init(loop_ptr, async_handle, high_level_wake_up_cb); - + // initialize our loop data and store it in the loop let data: global_loop_data = { async_handle: async_handle, @@ -256,7 +256,7 @@ crust fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe { handle)); // TODO: iterate through open handles on the loop and uv_close() // them all - let data = ll::get_data_for_uv_handle(handle) as *global_loop_data; + //let data = ll::get_data_for_uv_handle(handle) as *global_loop_data; } fn high_level_tear_down(data: *global_loop_data) unsafe { @@ -458,12 +458,11 @@ mod test { }; log(debug, "exiting simple timer cb"); } - #[test] - fn test_uv_hl_simple_timer() unsafe { + + fn impl_uv_hl_simple_timer(hl_loop: high_level_loop) unsafe { let exit_po = comm::port::(); let exit_ch = comm::chan(exit_po); let exit_ch_ptr = ptr::addr_of(exit_ch); - let hl_loop = get_global_loop(); let timer_handle = ll::timer_t(); let timer_ptr = ptr::addr_of(timer_handle); interact(hl_loop) {|loop_ptr| @@ -489,4 +488,11 @@ mod test { comm::recv(exit_po); log(debug, "test_uv_hl_simple_timer: msg recv on exit_po, done.."); } + #[test] + #[ignore(cfg(target_os = "freebsd"))] + fn test_uv_hl_high_level_global_timer() unsafe { + let hl_loop = get_global_loop(); + impl_uv_hl_simple_timer(hl_loop); + impl_uv_hl_simple_timer(hl_loop); + } } \ No newline at end of file diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 2a4315bd842..adc62053345 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -27,8 +27,8 @@ rust_kernel::rust_kernel(rust_env *env) : // set up storage of pointers needed to // access the global loop. global_loop_chan = 0; - global_async_handle = (void**)::malloc( // FIXME -- can use this->malloc() - sizeof(void*)); // .. what do? + global_async_handle = (void**)::malloc( // FIXME--can't use this->malloc() + sizeof(void*)); // .. what do? *global_async_handle = (void*)0; // Create the single threaded scheduler that will run on the platform's