From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/29443 Path: main.gmane.org!not-for-mail From: Lloyd Zusman Newsgroups: gmane.emacs.gnus.general Subject: Re: Preventing multiple startups of Gnus by the same user? Date: 07 Mar 2000 23:18:08 -0500 Organization: Linux Hippopotamus Preserve Sender: owner-ding@hpc.uh.edu Message-ID: References: <1yr9dns8hk.fsf@earthling.aia.aig.com.au> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035166112 2795 80.91.224.250 (21 Oct 2002 02:08:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 02:08:32 +0000 (UTC) Return-Path: Original-Received: from lisa.math.uh.edu (lisa.math.uh.edu [129.7.128.49]) by mailhost.sclp.com (Postfix) with ESMTP id C5E8AD051E for ; Tue, 7 Mar 2000 23:19:02 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by lisa.math.uh.edu (8.9.1/8.9.1) with ESMTP id WAB00375; Tue, 7 Mar 2000 22:18:52 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 07 Mar 2000 22:18:29 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id WAA29465 for ; Tue, 7 Mar 2000 22:18:19 -0600 (CST) Original-Received: from ljz.net (ljz.net [205.230.65.138]) by mailhost.sclp.com (Postfix) with ESMTP id 752C1D051E for ; Tue, 7 Mar 2000 23:18:29 -0500 (EST) Original-Received: by ljz.net (Postfix, from userid 510) id 7FB793EC54; Tue, 7 Mar 2000 23:18:09 -0500 (EST) Original-To: ding@gnus.org X-Face: "!ga1s|?LNLE3MeeeEYs(%LIl9q[xV9!j4#xf4!**BFW_ihlOb;:Slb>)vy>CJM 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