nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Locking In Scripts and nmh Locking

2012-04-27 15:48:44
Ken Hornstein <kenh(_at_)pobox(_dot_)com> writes:
The basic philosophy and reason-for-existence of mh and of nmh is that that's
not the way to go. I should be allowed -- nay encouraged -- to use file system
tools to manipulate mh constructs.

Okay, let me put in my $0.02:

- I'm kinda with David Levine in that manipulating the MH files directly
is a sort of "Here be Dragons" kind of thing.
- But I also believe that if you want to hang yourself then you should
be allowed to buy the rope.

So, given that ... I'm fine with some kind of locking program.  I
see this as a distinct issue from the "cron jobs modify the MH
context" problem; Ralph has already shown a reasonable soution for
that.  My thinking is that you would use this program only for
fiddling with MH files outside of MH programs.  It would NOT be for
running one or more MH commands inside of a lock.  E.g., something
like:

mhlock pick -seq ...

would deadlock.

So, here's a usage I'm thinking of:

mhlock [-seq] [-context] [-folder foldername] [-all] [--] command

The -seq, -context, -folder switches would control what it would lock.
-all would lock all things.  mhlock would then run the command specified
on the command line under the lock, then exit.

To make sure I understand this, I will discuss only the the -all case, which is
all I asked for. (There would appear to be complex interactions between the
other cases; it would hurt my brain to understand them.)

Is this how

     mhlock -all -- command

would work?

     command is not executed until no other 'mhlock -all' is running, and until
     no relevant nmh program is running. While command is running no other
     mhlock -all runs nor does any relevant nmh program run. When several
     'mhlock -all's and/or relevant nmh programs are contending, there is no
     guarantee about which will run first. The exit status of mhlock would be
     that of command.

Maybe? there should be --noblock and --block arguments with --block the
default?? If --noblock then command runs immediately or mhlock exits with a
special value for its exit status.

Maybe? [-seq] [-context] [-folder foldername] is overkill??

    Norman Shapiro

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>