Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Manx help Keywords: Manx Aztec DOS Locks Message-ID: <75253@sun.uucp> Date: 29 Oct 88 00:30:23 GMT References: <5918@killer.DALLAS.TX.US> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 24 In article <5918@killer.DALLAS.TX.US> (Jim Pritchett) writes: > ... I'm sure that there is a problem with my >(mis)understanding of locks, but I don't know what it is. Locks are "funny" but once you get to know them they can be your friends. Point #1 Lock() returns a BPTR to a FileLock structure, *not* a pointer. Point #2 Only unlock what you lock. Check this out ... -> lockram = Lock("ram:t", ACCESS_READ); /* cool you get a lock */ -> lockcd = CurrentDir(lockram); -> UnLock(lockram); /* Once */ -> lockram = CurrentDir(lockcd); -> UnLock(lockcd); /* Twice */ -> UnLock(lockram); /* Three times your out. */ ->} The only lock you can legally unlock is the one in lockram originally. When you entered you had a lock in CurrentDir (which you don't "own") and you didn't leave one there when you left. Understand? --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.