[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 10:15:45 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>>>> I think the implication is that you would have to add one (and use it
>>>> every time any code whatsoever accessed that variable).
>>> It's already being used several places without any locking.
>> Indeed, because it's only accessed by a single thread right now (it's
>> not even accessed from a signal handler). So you'd have to add locking
>> if it becomes shared between threads.
> Since it is using Lisp values it cannot be used by anything but the main
> thread anyway.
It's true that the other thread can't do things like call Fcons (before
the allocation code is not synchronized either), but the other thread can
still perform an assignment to a Lisp_Object variable, as long as that
variable is properly synchronized.
So you just have to ensure that the allocation of the pending_funcalls
element is done before forking the new thread.
I.e. when the name resolution is over, the other thread will want to do
something like:
lock(pending_funcalls);
setcar(result, pending_funcalls);
pending_funcalls = result;
unlock(pending_funcalls);
Of course, that leaves open the problem of how to translate the non-Lisp
result into Lisp_Objects.
I.e. you'll probably want to use some new variable, very similar to
pending_funcalls, but for "pending_c_funcalls" so that the pending calls
can first do some C preprocessing to turn the C result data into Lisp data
and then call the Elisp callback.
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 <=
- 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, 2010/11/04