emacs-devel
[Top][All Lists]
Advanced

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

Re: [patch] cache color info for remote X sessions [Was: Emacs 21/X11 ge


From: Ami Fischman
Subject: Re: [patch] cache color info for remote X sessions [Was: Emacs 21/X11 generating unbelieveable network traffic]
Date: Mon, 07 Oct 2002 08:35:59 -0700
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.50 (i686-pc-linux-gnu)

"Stefan Monnier" <monnier+gnu/address@hidden> writes:

[...]

> Yuck!  At least use alloca.  Disallowing re-entrance is always a bad idea.

I agree with the first and third statements.  But, I was unaware that emacs
had threading support (in fact, I was under the impression that it was
highly NON re-entrant, which is why, for instance, running lisp routines in
the background of an emacs session is not possible).  I've converted to use
alloca (it's just the two buffers), and it works just as well.  

But, if there's a possibility that these routines will be used in a
re-entrant manner, I should add a mutex lock to the cache.  Is this really a
possibility, or were you just expressing a distaste for non-re-entrant code
on principle?

> By the way, is the cached answer always the same as the one we would have
> goten without the cache ?  

For AllocColor, yes.  For XQueryColor{,s}, no.

> IF not, what is the potential impact ?  

The worst that can happen is that an old RGB set would be returned for a
pixel value (rather than the new one), and thus that the wrong color will
be shown in emacs.

> Can/should we invalidate the cache sometimes to avoid/reduce those
> problems ?

"should" -> yes.  "Can" is trickier.  In order for an old cache entry to be
"wrong", the X server will have to allocate a colormap entry once, then
dealloc it, then allocate another color in that space.  Which really comes
down to the X server having very few colormap entries and an app that asks
for a lot.  I don't think emacs will be running into this problem soon
(although, testing with xpms/pngs might be instructive here).  

-- 
  Ami Fischman
  address@hidden






reply via email to

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