Hi Bill,
I don't know if the following will actually be of any use to you but it
may be of interest nonetheless. It answers some of the vagueness I had
about this notion Oz has of 'Tickets'.
As an example, I have a problem which requires two independent processes
to be able to access the same set of files but with exclusive access
rights. It should also be noted that these processes need not be on the
same computer nor in fact in the same country for that matter.
Process1 creates a locking 'entity' with the command:
MyLock={Lock.new}
Oz then provides the following structure:
lock Mylock then
<execute file code here>
end
which guards the bracketed code so that it can only execute when MyLock
is 'available'.
Now the really clever part is that Oz has a facility to offer 'tickets'
to ANY language entity (including procedure definitions, classes,
variables, etc). These tickets take the form of a string which
references an Oz entity within the offering process. Oz also has the
facility to save ANY language entity to disk, web server, whatever
(pickling).
So, in my process1, I create a ticket to offer 'MyLock' :
Ticket={Connection.offerOnce MyLock}
I then save the ticket string as a 'pickled' value.
{Pickle.save Ticket <some_location>
My process2 can now load this value and 'take' the ticket offered like this:
Process1Ticket={Pickle.load <some_location>}
Process1Lock={Connection.take OtherProcessTicket}
and I can now guard my file access in process2 with:
lock Process1Lock then
<do my other file processing>
end
In other words, through the use of 'tickets', Oz transparently sets up
inter-process communication to allow a locking control to be available
concurrently to two completely unconnected processes. Each process
suspends correctly upon the lock control value in what, 5 lines of code
per process?
I couldn't believe how simple it all turns out to be. Initially I
thought I must be wrong!
Hope this clarifies the ticket idea I mentioned.
Regards
Mark R
--
Mark Richardson MBCS
Email: [email protected]
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users