Gnus development mailing list
 help / color / mirror / Atom feed
* Preventing multiple startups of Gnus by the same user?
@ 2000-03-07  3:49 Lloyd Zusman
  2000-03-07  3:55 ` Karl Kleinpaste
  0 siblings, 1 reply; 7+ messages in thread
From: Lloyd Zusman @ 2000-03-07  3:49 UTC (permalink / raw)


I normally have a few virtual desktops running with a number of
windows open, and occasionally I lose sight of the fact that I already
have an XEmacs running a Gnus session when I go to start up Gnus
again.

I'd like to be able to prevent this, somehow.  Does there already
exist a reliable way to tell either before or during Gnus startup that
the same user on the same machine already has a Gnus session running?

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07  3:49 Preventing multiple startups of Gnus by the same user? Lloyd Zusman
@ 2000-03-07  3:55 ` Karl Kleinpaste
  2000-03-07  4:04   ` Lloyd Zusman
  0 siblings, 1 reply; 7+ messages in thread
From: Karl Kleinpaste @ 2000-03-07  3:55 UTC (permalink / raw)


Lloyd Zusman <ljz@asfast.com> writes:
> Does there already exist a reliable way to tell either before or
> during Gnus startup that the same user on the same machine already
> has a Gnus session running?

Cf. gnus-alive-p.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07  3:55 ` Karl Kleinpaste
@ 2000-03-07  4:04   ` Lloyd Zusman
  2000-03-07  4:35     ` Andrew J Cosgriff
  2000-03-07 20:47     ` Jan Vroonhof
  0 siblings, 2 replies; 7+ messages in thread
From: Lloyd Zusman @ 2000-03-07  4:04 UTC (permalink / raw)


Karl Kleinpaste <karl@justresearch.com> writes:

> Lloyd Zusman <ljz@asfast.com> writes:
> > Does there already exist a reliable way to tell either before or
> > during Gnus startup that the same user on the same machine already
> > has a Gnus session running?
> 
> Cf. gnus-alive-p.

OOPS ... I'm sorry, but I wasn't clear enough in my original question,
although thank you very much for your quick reply.

I'll try to do a better job with my question:

Suppose I have started up XEmacs as a certain user on my machine, and
this XEmacs process is running Gnus.  Now, suppose I forget that this
original XEmacs process is evan running and I start XEmacs up all over
again under that same user ID.  Now, suppose I try to start Gnus
under this second XEmacs process.  What I'd like to do is for this
second Gnus to never start up because there's another one running
as the same user ID within a different process.

Unless I'm mistaken, `gnus-alive-p' only checks for an already-running
Gnus within a single XEmacs process.

If this cannot be done directly using Gnus, perhaps XEmacs provides some
functions that I can use to implement this ... ???

Thanks again in advance ...

-- 
 Lloyd Zusman
 ljz@asfast.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07  4:04   ` Lloyd Zusman
@ 2000-03-07  4:35     ` Andrew J Cosgriff
  2000-03-08  4:18       ` Lloyd Zusman
  2000-03-07 20:47     ` Jan Vroonhof
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew J Cosgriff @ 2000-03-07  4:35 UTC (permalink / raw)


Lloyd Zusman wrote :

> Suppose I have started up XEmacs as a certain user on my machine,
> and this XEmacs process is running Gnus.  Now, suppose I forget that
> this original XEmacs process is evan running and I start XEmacs up
> all over again under that same user ID.  Now, suppose I try to start
> Gnus under this second XEmacs process.  What I'd like to do is for
> this second Gnus to never start up because there's another one
> running as the same user ID within a different process.
> 
> Unless I'm mistaken, `gnus-alive-p' only checks for an
> already-running Gnus within a single XEmacs process.
> 
> If this cannot be done directly using Gnus, perhaps XEmacs provides
> some functions that I can use to implement this ... ???

Do you run gnuserv ?  Only one instance of gnuserv can run per user,
so if you start it a second time in a second copy of emacs it'll die
straight away - perhaps just before you try starting gnuserv in your
.emacs you could run "gnuclient -eval '(gnus-alive-p)'" and see what
it says - if there's already a copy of XEmacs running gnuserv that's
running gnus, it'd work.

Of course, if you're in the habit of running multiple copies of
XEmacs, you'd prolly want to make sure that only the one running Gnus
is the one that runs gnuserv...

HTH.

-- 
Andrew J Cosgriff <ajc@polydistortion.net> keep left



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07  4:04   ` Lloyd Zusman
  2000-03-07  4:35     ` Andrew J Cosgriff
@ 2000-03-07 20:47     ` Jan Vroonhof
  2000-03-08  4:20       ` Lloyd Zusman
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Vroonhof @ 2000-03-07 20:47 UTC (permalink / raw)


Lloyd Zusman <ljz@asfast.com> writes:

> under this second XEmacs process.  What I'd like to do is for this
> second Gnus to never start up because there's another one running
> as the same user ID within a different process.

Does it help if you compile --with-clash-detection (in the hope XEmacs
would then complain if the second Gnus tries to open .newsrc.eld)

Jan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07  4:35     ` Andrew J Cosgriff
@ 2000-03-08  4:18       ` Lloyd Zusman
  0 siblings, 0 replies; 7+ messages in thread
From: Lloyd Zusman @ 2000-03-08  4:18 UTC (permalink / raw)


Andrew J Cosgriff <ajc@bing.wattle.id.au> writes:

> Lloyd Zusman wrote :
> 
> > Suppose I have started up XEmacs as a certain user on my machine,
> > and this XEmacs process is running Gnus.  [ ... ]
> > [ ... ] What I'd like to do is for
> > this second Gnus to never start up because there's another one
> > running as the same user ID within a different process.
> > 
> > [ ... ]
> 
> Do you run gnuserv ?  Only one instance of gnuserv can run per user,
> so if you start it a second time in a second copy of emacs it'll die
> straight away - perhaps just before you try starting gnuserv in your
> .emacs you could run "gnuclient -eval '(gnus-alive-p)'" and see what
> it says - if there's already a copy of XEmacs running gnuserv that's
> running gnus, it'd work.

Thanks for this suggestion.  I do run gnuserv and hadn't thought of
this, and I was able to code up something that works pretty much
the way you suggest.

However, this approach has a race condition that I don't know how to
get rid of.  To explain the race condition, I first have to show you
my new Gnus startup code:

  (gnuserv-start)
  (sit-for 3)
  (cond
   ((eq (process-status gnuserv-process) 'run)
    (gnus))
   (t
    (message "user %s: another Gnus is running" (user-login-name))))

It turns out that `gnuserv-start' returns right away, before the
gnuserv executable itself can determine whether there's another
instance of itself running or not.  Right after `gnuserv-start'
returns, the status of that process is always "run".  Only after a
short while does the status change to "error" if there's another
gnuserv process.

I looked through the gnuserv.el elisp code and there doesn't seem to
be any way to avoid this race condition.  Even `gnuserv-init-hook'
doesn't help me, because it too is affected by the same race condition
(i.e., I'd have to wait a couple seconds inside of that routine also
in order to detect whether or not the gnuserv process failed).

I can live with this race condition, since the code I wrote works
and I can always increase the `sit-for' time.  But is there any
way to eliminate this race condition altogether? ... or maybe
yet another approach to accomplish what I want?


> [ ... ]
> 
> HTH.

Indeed is has helped, since as I mentioned, I can minimize the effects
of the race condition.  Thank you very much!

-- 
 Lloyd Zusman
 ljz@asfast.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Preventing multiple startups of Gnus by the same user?
  2000-03-07 20:47     ` Jan Vroonhof
@ 2000-03-08  4:20       ` Lloyd Zusman
  0 siblings, 0 replies; 7+ messages in thread
From: Lloyd Zusman @ 2000-03-08  4:20 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> Lloyd Zusman <ljz@asfast.com> writes:
> 
> > under this second XEmacs process.  What I'd like to do is for this
> > second Gnus to never start up because there's another one running
> > as the same user ID within a different process.
> 
> Does it help if you compile --with-clash-detection (in the hope XEmacs
> would then complain if the second Gnus tries to open .newsrc.eld)

Hmmm ... I'll have to try that the next time I recompile XEmacs.  Does
anyone know if I can detect some kind of trappable error if another
Gnus has my .newsrc.eld open when running under an XEmacs that's
compiled with this option?

Thanks for the suggestion!

-- 
 Lloyd Zusman
 ljz@asfast.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-03-08  4:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-07  3:49 Preventing multiple startups of Gnus by the same user? Lloyd Zusman
2000-03-07  3:55 ` Karl Kleinpaste
2000-03-07  4:04   ` Lloyd Zusman
2000-03-07  4:35     ` Andrew J Cosgriff
2000-03-08  4:18       ` Lloyd Zusman
2000-03-07 20:47     ` Jan Vroonhof
2000-03-08  4:20       ` Lloyd Zusman

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 NNTP newsgroup(s).