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

Re: File sharing and locking

At  1:22 PM 5/23/94 +0000, Denis Howlett wrote:
>Can anyone tell me how to go about locking a file so that I can manage
>several concurrent users accessing the same file?
>We have a number of data files that people read. Typically they load them
>into our application and then at some later stage, save the changes. I want
>to be able to "lock" these files for the duration of the user's session so
>that I can manage problems between two people trying to save the same file.
>So, I'm interested in locking it so that others can still read but not
>write, and locking so that others can't even read it.
>I know there are some finder parameters that handle locking and busy, but
>I'm not sure which to use and how to do it from MCL.

LOCK-FILE and UNLOCK-FILE deal with the lock property that is visible
in the Finder's "Get Info..." box. They have on-line documentation.
This prevents a file from being written by anybody, including you.

You may be able to just open the file to lock it. If a file is open by
anyone with read access, it cannot be opened for write access. If a file
is opened with write or read/write access, it cannot be opened for reading
or writing by another application.