[Mono-dev] Thread Pool WAPI Ref Problems

Brian Crowell mono-devel at fluggo.com
Thu Sep 21 16:53:54 EDT 2006

Patrick Earl wrote:
> Is it correct to assume that wapi handles for threads should stick 
> around until sometime after the thread finishes executing?

Thread has a finalizer that calls Thread_free_internal in metadata/threads.c 
(554), which then just calls CloseHandle. So that's probably when the handle is 
supposed to disappear; when the GC calls the finalizer.

Of course, that's for threads created using the System.Threading namespace. I 
don't know how the other threads disappear, but threads.c is littered with all 
kinds of CloseHandle calls, and some places where CloseHandle is explicitly not 
called, such as mono_thread_detach.


More information about the Mono-devel-list mailing list