Welcome, Guest. Please login or register.

Author Topic: Getting *locked* in  (Read 941 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Getting *locked* in
« 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?  
H2O2
 

Offline Thomas

Re: Getting *locked* in
« Reply #1 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

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Re: Getting *locked* in
« Reply #2 on: April 22, 2004, 10:21:29 PM »
Gee...  Um, you're right as usual.  Thanks for the feedback Thomas.  
H2O2