emacs-devel
[Top][All Lists]
Advanced

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

Re: advice needed for multi-threading patch


From: Stefan Monnier
Subject: Re: advice needed for multi-threading patch
Date: Mon, 28 Sep 2009 23:20:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> You seem to say that it should return "/foo", but currently it returns
>> something else.  Maybe we should try to come up with a run-time test to
>> catch such cases in current Lisp code.

> I suspect that any sensible approach we come up with is going to
> involve a change in behavior that may affect some existing code.  So  coming
> up with ways to detect code that changes meaning is probably  going to
> be a good idea.

Yes, that's what I meant.

>> A related case is when a process filter or a sentinel is run via
>> accept-process-output: we'd need to be careful to make sure the code
>> is run in the same thread as the code that called
>> accept-process-output.

> Not necessarily; two threads could each be running helper programs in
> subprocesses (or using network connections), setting up let-bound
> variables, and calling accept-process-output, expecting the process filters
> to have access to the let-bound variables.

I think you're thinking of the case where accept-process-output is
called without specifying any particular process to wait for, whereas
I was thinking of the case where accept-process-output is called with
a process argument.

>> Redisplay should be run in a completely separate thread (at least
>> conceptually).

> I think it's less likely, but a package might also let-bind some variables
> that affect the display (e.g., truncate-lines, selective- 
> display, show-trailing-whitespace, all of which are buffer-local, or
> anything referenced via mode-line) and then call y-or-n-p or read-file- 
> name or some other routine that will trigger redisplay and prompt the user
> for some info that may depend on what's displayed....

Yes, I know this happens with things like cursor-in-echo-area, tho this
is a global variable.  Not sure how often (or even if) this happens with
buffer-local vars. 

> So... yeah, I think I like the conceptually-separate-thread approach better,
> even if it could break existing code.  I'm not certain we couldn't do
> better in terms of backwards compatibility, but it's simple and clean.

It's improtant to maximize backward compatibility, but it's also to try
and avoid getting locked in overly complex semantics, especially in the
long run.


        Stefan




reply via email to

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