[Mono-dev] Thread Pool WAPI Ref Problems

Patrick Earl pat.earl at advmeas.com
Thu Sep 21 12:43:55 EDT 2006


Hi.  I've been trying to track what might be causing the issue in the 
following bug:

    http://bugzilla.ximian.com/show_bug.cgi?id=79060

It seems to be some problem with wapi refs in the threadpool.  In any 
case, though I don't have a good understanding of how everything 
connects, I did notice one strange thing when I was poking through the code.

In the start_thread_or_queue method, there is a domain variable assigned 
that is never used.  Is there a problem here?

static void
start_thread_or_queue (MonoAsyncResult *ares)
{
        int busy, worker;
        MonoDomain *domain;

        busy = (int) InterlockedCompareExchange (&busy_worker_threads, 
0, -1);
        worker = (int) InterlockedCompareExchange (&mono_worker_threads, 
0, -1);
        if (worker <= ++busy &&
            worker < mono_max_worker_threads) {
                InterlockedIncrement (&mono_worker_threads);
                InterlockedIncrement (&busy_worker_threads);
HERE:     domain = ((MonoObject *) ares)->vtable->domain;
                mono_thread_create (mono_get_root_domain (), 
async_invoke_thread, ares);
        } else {
                append_job (&mono_delegate_section, &async_call_queue, 
ares);
                ReleaseSemaphore (job_added, 1, NULL);
        }
}

I do know that this particular method is called for the leaked handles.

Thanks.

        Patrick Earl



More information about the Mono-devel-list mailing list