[comp.os.vms] 'Waiting' for files

CHAA006@vaxb.rhbnc.ac.UK (01/21/88)

Grant (and other interested parties) ... I too have had thoughts in the past on
the concept of 'waiting' for files (i.e. awakening only when a file is touched);
one possible application concerns automatic post-processing of incoming mail:
some brain-damaged VMS mailers are unable to forward mail across any alternate
protocol; if one could arrange for all i/c mail to be delivered to a single
account, a detached process could automatically be awakened whenever such mail
arrives; it could then post-process the mail, forwarding it in the normal way. 

As to a VMS implementation, I believe that blocking-ASTs are the very thing:
what is needed is to take out a lock on the file, specifying a blocking AST;
when another process attempts to access that file, the AST will be fired, and
the nominated process awakend.  However, there are (considerable) complications
... 

Simply taking out a lock on a file is not sufficient: locks are independent
entities, regardless of the entity which they nominally lock; if RMS uses one
lock, and you use another, there will be no interlock and no AST. One therefore
needs to know the name by which RMS refers to the lock, and there seems no
simple way of ascertaining this, but I believe it _may_ be possible:  one can
ask VMS for a list of all locks held by a process; if one does that first, then
opens the file and asks again, I suspect that a new lock will show up in the
process' lock-table: if true, that will be the lock which RMS uses to access
that particular file, and the information can then be used to access the lock
directly. 

Has anyone ever tried this ?  Will it work ?   ** Phil.