[Top][All Lists]
[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
- Re: Async DNS lookups, (continued)
- Re: Async DNS lookups, Stefan Monnier, 2010/11/02
- Re: Async DNS lookups, Lars Magne Ingebrigtsen, 2010/11/03
- Re: Async DNS lookups, Davis Herring, 2010/11/03
- Re: Async DNS lookups, Lars Magne Ingebrigtsen, 2010/11/03
- Re: Async DNS lookups, Stefan Monnier, 2010/11/03
- Re: Async DNS lookups, Andreas Schwab, 2010/11/04
- Re: Async DNS lookups, Stefan Monnier, 2010/11/04
- Re: Async DNS lookups, Ken Raeburn, 2010/11/04
- Re: Async DNS lookups, Lars Magne Ingebrigtsen, 2010/11/04
- Re: Async DNS lookups, Davis Herring, 2010/11/04
- Re: Async DNS lookups,
Stefan Monnier <=