From 67ed8d1287c6dc9d7786a74e7b2c7735c4cce970 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Mon, 23 Mar 2015 13:52:17 -0400 Subject: [PATCH] Improve close methods for SingleAsyncWork close(t::Timer) also works for SingleAsyncWork, so let that method take both. Further, the close hook for SingleAsyncWork needs to remove it from the preservation dict. --- base/stream.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base/stream.jl b/base/stream.jl index 8a74484486587..1c5259c0d4eba 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -462,7 +462,7 @@ type Timer <: AsyncWork end end -close(t::Timer) = ccall(:jl_close_uv,Void,(Ptr{Void},),t.handle) +close(t::AsyncWork) = ccall(:jl_close_uv,Void,(Ptr{Void},),t.handle) function _uv_hook_close(uv::Union(AsyncStream,UVServer)) uv.handle = C_NULL @@ -474,7 +474,8 @@ function _uv_hook_close(uv::Union(AsyncStream,UVServer)) try notify(uv.readnotify) end try notify(uv.connectnotify) end end -_uv_hook_close(uv::AsyncWork) = (uv.handle = C_NULL; nothing) +_uv_hook_close(uv::Timer) = (uv.handle = C_NULL; nothing) +_uv_hook_close(uv::SingleAsyncWork) = (uv.handle = C_NULL; unpreserve_handle(uv); nothing) # This serves as a common callback for all async classes function _uv_hook_asynccb(async::AsyncWork)