unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: Miles Bader <miles@gnu.org>, Francesco Potorti` <pot@gnu.org>,
	emacs-devel@gnu.org, savannah-hackers@gnu.org,
	cvs-hackers@gnu.org, system-hackers@gnu.org
Subject: Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock
Date: 13 Jul 2002 01:31:16 +0200	[thread overview]
Message-ID: <5xy9cg7ccb.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <20020712215303.GG3227@elephant.166-78-158.ipt.aol.com>

Mathieu Roy <yeupou@gnu.org> writes:

> 
> In fact, this is more complex than just removing a lock file. We need
> to remove the process that create the lock file too.

Which is why any sensible application writes its own PID in the
lock files so other applications can easily check whether the
lock is still valid by doing a check like

        while (file_exists(LOCK_FILE)) {
                pid = atoi(read_first_line_of_file(LOCK_FILE));
                if (pid <= 0) {
                        /* lock file is incomplete,
                           wait for locker to write its pid. */
                        sleep(1);
                        continue;
                }
                if (kill(pid, 0) == 0) {
                        /* lock is valid */
                        sleep(5);
                        continue;
                }
                /* remove stale lock and go on */
                unlink(LOCK_FILE);
        }
        /* Now it is our turn to create the file */
        
-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2002-07-12 23:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10 11:22 emacs/lisp/ChangeLog CVS lock Simon Josefsson
2002-07-10 11:51 ` Juanma Barranquero
2002-07-11  7:00   ` Francesco Potorti`
2002-07-11  9:42     ` Kim F. Storm
2002-07-11 11:44       ` [Savannah-hackers] " Mathieu Roy
2002-07-11 12:00         ` Andreas Schwab
2002-07-11 12:15           ` Mathieu Roy
2002-07-11 12:39             ` Andreas Schwab
2002-07-11 14:40           ` Jeff Bailey
2002-07-11 15:41             ` Andreas Schwab
2002-07-11 12:11         ` Francesco Potorti`
2002-07-11 12:16           ` Mathieu Roy
2002-07-12  1:57           ` Miles Bader
2002-07-12  6:36             ` Mathieu Roy
2002-07-12  6:58               ` Miles Bader
2002-07-12 21:53                 ` Mathieu Roy
2002-07-12 23:31                   ` Kim F. Storm [this message]
2002-07-12  8:23             ` Francesco Potorti`
2002-07-12  2:32     ` GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock) Ken Raeburn
2002-07-12  2:55       ` Miles Bader
2002-07-12  3:03       ` Jeff Bailey
2002-07-12  6:00         ` Ken Raeburn
2002-07-12  6:39           ` Joel N. Weber II
2002-07-12 21:17           ` Jeff Bailey
2002-07-14 19:11             ` Ken Raeburn
2002-08-28 15:24 ` emacs/lisp/ChangeLog CVS lock Simon Josefsson
2002-08-29 12:23   ` Simon Josefsson

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=5xy9cg7ccb.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=cvs-hackers@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=pot@gnu.org \
    --cc=savannah-hackers@gnu.org \
    --cc=system-hackers@gnu.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).