unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ami Fischman <usenet@fischman.org>
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	[thread overview]
Message-ID: <m3u1jy5kio.fsf@fischman.org> (raw)
In-Reply-To: 200210071453.g97Erqu24465@rum.cs.yale.edu

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> 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
  usenet@fischman.org

  reply	other threads:[~2002-10-07 15:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-06  0:21 [patch] cache color info for remote X sessions [Was: Emacs 21/X11 generating unbelieveable network traffic] Ami Fischman
2002-10-06  1:29 ` Miles Bader
2002-10-06  5:31   ` Ami Fischman
2002-10-06  6:53     ` Miles Bader
2002-10-06 17:59     ` Jan D.
2002-10-06 20:22       ` Ami Fischman
2002-10-06 18:14     ` Ami Fischman
2002-10-07 14:53     ` Stefan Monnier
2002-10-07 15:35       ` Ami Fischman [this message]
2002-10-07 15:52         ` Stefan Monnier
2002-10-07 16:49           ` Ami Fischman
2002-10-07 17:59             ` Jan D.
2002-10-07 18:14           ` Jan D.
2002-10-07 20:07             ` Stefan Monnier
2002-10-08  5:16               ` Jan D.
2002-10-08 17:21         ` Richard Stallman
2002-10-07 15:31     ` Richard Stallman
2002-10-07 17:04       ` Ami Fischman
2002-10-08 17:21         ` Richard Stallman
2002-10-06  7:46 ` Jan D.
2002-10-06 17:33   ` Ami Fischman
2002-10-07 15:31 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u1jy5kio.fsf@fischman.org \
    --to=usenet@fischman.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).