Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: peroxidechicken on April 22, 2004, 01:51:27 PM

Title: Getting *locked* in
Post by: peroxidechicken on April 22, 2004, 01:51:27 PM
What's the done thing concerning old locks returned by the DOS CurrentDir() call?  

My guess (as I don't have specific DOS reference material) is that a program started from WB can just unlock all of these but if a program is started from the Shell, should it be careful to exit with it's current directory set as it was at the beginning?  
Title: Re: Getting *locked* in
Post by: Thomas on April 22, 2004, 03:17:31 PM
Why don't you read what people tell you : http://www.amiga.org/forums/showthread.php?t=8046

You must not UnLock() any locks you didn't Lock() on your own. And you must not UnLock() any lock currently in use by DOS.

The only allowed sequence is:

lock1 = Lock(dir1)
oldlock = CurrentDir(lock1)
lock2 = Lock(dir2)
CurrentDir(lock2)   /* should return lock1 */
UnLock (lock1)
lock3 = Lock(dir3)
CurrentDir(lock3)   /* should return lock2 */
UnLock (lock2)
Currentdir (oldlock) /* should return lock3 */
UnLock (lock3)

Bye,
Thomas
Title: Re: Getting *locked* in
Post by: peroxidechicken on April 22, 2004, 10:21:29 PM
Gee...  Um, you're right as usual.  Thanks for the feedback Thomas.