[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock
From: |
Kim F. Storm |
Subject: |
Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock |
Date: |
13 Jul 2002 01:31:16 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Mathieu Roy <address@hidden> 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 <address@hidden> http://www.cua.dk
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, (continued)
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Jeff Bailey, 2002/07/11
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Andreas Schwab, 2002/07/11
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Francesco Potorti`, 2002/07/11
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Mathieu Roy, 2002/07/11
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Miles Bader, 2002/07/11
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Mathieu Roy, 2002/07/12
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Miles Bader, 2002/07/12
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Mathieu Roy, 2002/07/12
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock,
Kim F. Storm <=
- Re: [Savannah-hackers] Re: emacs/lisp/ChangeLog CVS lock, Francesco Potorti`, 2002/07/12
- GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Ken Raeburn, 2002/07/11
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Miles Bader, 2002/07/11
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Jeff Bailey, 2002/07/11
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Ken Raeburn, 2002/07/12
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Joel N. Weber II, 2002/07/12
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Jeff Bailey, 2002/07/12
- Re: GNU Kerberos breakage (was Re: emacs/lisp/ChangeLog CVS lock), Ken Raeburn, 2002/07/14