emacs-devel
[Top][All Lists]
Advanced

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

Re: Async DNS lookups


From: Tom Tromey
Subject: Re: Async DNS lookups
Date: Tue, 02 Nov 2010 12:30:16 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>>>> "Lars" == Lars Magne Ingebrigtsen <address@hidden> writes:

Lars> 2) C does pthread_create() (right?), and lets the main thread return
Lars>    from the call.  The other thread just does a normal getaddrinfo().

Lars> 3) When getaddrinfo() returns, we do
Lars>    (funcall #'my-callback result my-data)   

Lars> But 3) probably needs to be in the same sort of state that timers run
Lars> in, so that we don't have two Emacs Lisp threads running at the same
Lars> time.  Any pointers where to look for how to "halt" the main Emacs
Lars> thread?  Or something?   
   
I would suggest just keeping all the thread stuff in C.  Don't provide
any callback.  Instead, have the main thread run the event loop (a la
sit-for -- I don't know the C functions offhand) and return an answer
when the worker thread reports back.

You especially want to avoid referencing any lisp stuff from the worker
thread.  If you do that then you will need to make the GC thread-aware.
This is doable (it is on the concurrency branch), but it is overkill for
this application.

Tom



reply via email to

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