[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lockfiles and mutual exclusion



>>>>> "Adrian" == Adrian Bridgett <adrian.bridgett@zetnet.co.uk> writes:

    Adrian> update-menus forks to the background and waits for dpkg to
    Adrian> finish before continuing to work. This is a useful
    Adrian> function that could be useful for other programs (for
    Adrian> instance scripts that build automated indexes of other
    Adrian> kinds).

    Adrian> Is there a cunning way to achieve this at present?

 Grab `procmail', and RTFM `lockfile'.  That's one way it can be done.
 There's a little program with `smartlist' too, called `led' or
 something, that's a wrapper around an editorling[1].  It makes a
 lockfile, then starts the ed on the procmail run-control file you are
 working on.  As long as the lockfile is present, `procmail' will hang
 out until you're done.

 I wrote some XEmacs lisp code for editting procmail rc files that
 does a similar thing.  Some of you may like to have it; it's in my
 http dirs at:

         http://www.inetarena.com/~karlheg/Public/site-lisp/

 ... it's called `led-funcs.el' or suchlike.  It's a first pass effort
 and could use a workover, but functions well enough to use now.[2]

 A lock like this is called a "mutex lock". (do I pass the quiz?  or
 am I misusing the terms?)  That means "mutual exclusion lock".  As
 long as the programs involved honor the locking scheme, they'll not
 stomp on one another.

 `dpkg' and `dselect' make a lock file; I know because I've tried to
 start it while it's already running on another tty, and it told
 me. :-)


Footnotes: 
[1]  Not necessarily a sensible editor.

[2]  There's a few other things in there you might like to have. :-)

-- 
mailto:karlheg@bittersweet.inetarena.com (Karl M. Hegbloom)
http://www.inetarena.com/~karlheg
Portland, OR  USA
Debian GNU 1.3.1+hamm Linux 2.0.32 AMD K5 PR-133


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: