dirInitLock ⟨object⟩ [⟨spin⟩]
Initialize a lock object for your process. Only after a lock is initialized, your proccess will be able
to use it. Notice: This action does not lock the object.
The lock can be set on two types of objects. The first is an existing directory. In this case, Aq dir
must be a path (relative or full). The path must contain a ‘/’. The second is an abstract object used as
a lock. In this case, the name of the lock will not contain any ‘/’. This can be used to create locks
without creating real directories for them. Notice: Do not call your lock object ‘.lock’.
Parameters:
⟨object⟩
The name of the lock object (either existing directory or abstract name)
⟨spin⟩
The time (in seconds) that the funtion dirLock will wait between two runs of dirTryLock. This
parameter is optional, and its value generally should be less then 1. If ommited, a default value
(0.01) is set.
Return Value:
One of the following:
0 The action finished successfully.
1 The action failed. You do not have permissions to preform it.
3 The directory path could not be resolved. Possibly parameter does contain ‘/’, but refers to
directory that does not exist.
dirTryLock ⟨object⟩
Try to lock the lock object. The function always returns immediately.
Parameters:
⟨object⟩
The object that the lock is set on.
Return Value:
One of the following:
0 The action finished successfully.
1 The action failed. The object is already locked.
2 The action failed. Your proccess did not initialize a lock for the object.
3 The directory path could not be resolved.
dirLock ⟨object⟩
Lock given lock object. If the object is already locked - the function will block untill the object is
unlocked. After each try (dirTryLock) the function will sleep for spin seconds (spin is defined using
dirInitLock ).
Parameters:
⟨object⟩
The directory that the lock is set on.
Return Value:
One of the following:
0 The action finished successfully.
2 The action failed. Your proccess did not initialize a lock for the directory.
3 The directory path could not be resolved.
dirUnlock ⟨dir⟩
Unlock the lock object.
Parameters:
⟨object⟩
The object that the lock is set on.
Return Value:
One of the following:
0 The action finished successfully.
2 The action failed. Your proccess did not initialize the lock.
3 The directory path could not be resolved.
dirDestroyLock ⟨object⟩
Destroys the lock object. After this action the proccess will no longer be able to use the lock object.
To use the object after this action is done, one must initialize the lock, using dirInitLock.
Parameters:
⟨object⟩
The directory that the lock is set on.
Return Value:
One of the following:
0 The action finished successfully.
1 The action failed. The directory is locked by your own proccess. Unlock it first.
2 The action failed. Your proccess did not initialize the lock.
3 The directory path could not be resolved.