emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Async DNS lookups


From: Stefan Monnier
Subject: Re: Async DNS lookups
Date: Thu, 04 Nov 2010 17:32:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> And then you don't want to lock the pending_funcalls variable after all:
> you want to have a lock on the pending_c_funcalls and do something like

> /* DNS thread */
x-> data=lookup(...); /* slow */
> lock(pending_c_funcalls_mutex);
x-> next=pending_c_funcalls;
> pending_c_funcalls=x;
> unlock(pending_c_funcalls_mutex);

> /* main thread */
> lock(pending_c_funcalls_mutex);
> for(;pending_c_funcalls;pending_c_funcalls=pending_c_funcalls->next)
>   pending_funcalls=Fcons(convert_async(pending_c_funcalls),
>                          pending_funcalls);
> unlock(pending_c_funcalls_mutex);
> /* ...existing Ffuncall() code... */

> Right?

Right, except that instead of

   pending_funcalls=Fcons(convert_async(pending_c_funcalls),
                          pending_funcalls);

I'd just do

   pending_c_funcalls->f (pending_c_funcalls->arg);
   

-- Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]