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

Re: [MacPerl] file locking



At 23.53 -0500 12.27.1998, Eric Albert wrote:
>At 05:49 PM 12/27/98 -0500, Chris Nandor wrote:
>[locking code snipped]
>>
>>I think that should lock the file, and then unlock it open exiting the
>>program, even if it exits prematurely (unless MacPerl itself dies).
>>
>>Any thoughts?
>
>Well, David's testing looks good, so that's a good start.
>
>I was wondering, though, about the case in which MacPerl dies.

Well, my long-term vision goes something like this:

  * flock with LOCK_SH or LOCK_EX will call FSpSetFLock, and with LOCK_UN
will call FSpRstFLock.

  * MacPerl will record what has been locked, and with what type of lock,
and what program/process locked it (this requires some planning), in a
separate prefs file.  It will record when something has been unlocked.

  * Other Mac apps will not respect a LOCK_EX, but other MacPerls or other
MacPerl threads would.

  * Upon exiting a program, all files locked for that program and not
unlocked will be unlocked.

  * If MacPerl crashes before unlocking, it will unlock those files on
restarting.  It must be careful not to unlock files locked by programs that
might be running in another MacPerl program that is currently running.

That's the general idea, anyway.  Matthias is the one who would probably
implement it and refine it, so about all I can do it suggest ideas.  :)

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch